Skip to content

Commit

Permalink
vimrc: few more tweak to it closer to vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
yml committed Mar 8, 2019
1 parent 6b793f1 commit 518d100
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 60 deletions.
54 changes: 1 addition & 53 deletions _bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,58 +61,6 @@ xterm*|rxvt*)
;;
esac

# TODO delete if it is still commented in few months (2018-09-13)
# Set up TERM variables.
# vt100 and xterm have no color in vim (at least on unixs), but if we call them xterm-color, they will.
# (vt100 for F-Secure SSH.)
# This may well be the case for some other terms, so I'm putting them here.
# Also set up a variable to indicate whether to set up the title functions.
# TODO gnome-terminal, or however it reports itself
# case $TERM in

# screen)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=true
# ;;

# xterm-color|color_xterm|rxvt|Eterm|screen*) # screen.linux|screen-w
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=true
# ;;

# linux)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=false
# ;;

# xterm|vt100)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=true
# ;;

# *xterm*|eterm|rxvt*)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=true
# ;;

# *)
# TERM_IS_COLOR=false
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=false
# ;;

# esac
# ----------- End of previous section ----------------

# function to an npm bin to $PATH
Expand Down Expand Up @@ -167,7 +115,7 @@ else
fi

# remap caps lock to escape
[[ -x $(command -v setxkbmap) ]] && setxkbmap -option "caps:swapescape"
# [[ -x $(command -v setxkbmap) ]] && setxkbmap -option "caps:swapescape"

# Set my GPG key
export GPGKEY=2F74DA04
Expand Down
27 changes: 20 additions & 7 deletions _vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ if has("nvim-0.3.0")
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[c` and `]c` for navigate diagnostics
nmap <silent> [c <Plug>(coc-diagnostic-prev)
nmap <silent> ]c <Plug>(coc-diagnostic-next)
nmap <silent> <LEFT> <Plug>(coc-diagnostic-prev)
nmap <silent> <RIGHT> <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
Expand Down Expand Up @@ -132,6 +132,19 @@ if has("nvim-0.3.0")
command! -nargs=? CocFold :call CocAction('fold', <f-args>)
command! -nargs=0 CocPrettier :CocCommand prettier.formatFile

" Using CocList
" Show all diagnostics
nnoremap <silent> <space>d :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
endif

"*****************************************************************************"
Expand Down Expand Up @@ -246,13 +259,9 @@ set title
set titleold="Terminal"
set titlestring=%F

function! ShortFilename() abort
return pathshorten(expand("%"))
endfunction

" Statusline definition
set statusline= " Clear
set statusline+=%{ShortFilename()} " Tail of the filename
set statusline+=%{pathshorten(expand('%'))} " Tail of the filename
set statusline+=%h " Help file flag
set statusline+=%r " Read only flag
set statusline+=%m " Modified flag
Expand Down Expand Up @@ -347,6 +356,9 @@ command! -nargs=+ -complete=file Agraw call fzf#vim#ag_raw(<q-args>)
"*****************************************************************************
" Mappings
"*****************************************************************************
" Remap escape
imap ii <ESC>
" Edit my nvim configuration
nnoremap <leader>vo :vsplit $MYVIMRC<cr>
" Reload nvim configuration
Expand Down Expand Up @@ -381,6 +393,7 @@ nnoremap <Leader>fh :History<CR>
nnoremap <leader>fb :Buffers<CR>
nnoremap <leader>fl :Lines<CR>
nnoremap <leader>ff :Files<CR>
nnoremap <C-p> :Files<CR>
nnoremap <leader>fc :Commits<CR>
noremap <Leader>fw :exe ':Ag ' . expand('<cword>')<CR>
noremap <Leader>f :Ag<CR>
Expand Down

0 comments on commit 518d100

Please sign in to comment.