dotfiles/.vimrc.keymap
2019-02-25 16:28:13 +00:00

56 lines
1.3 KiB
Text
Executable file

" key mappings
let mapleader = ","
nmap <Leader>s :update<CR>
nmap <leader>p :set paste!<CR>
nmap <leader>h :set hlsearch!<CR>
nmap <leader>t :wa <bar> :Make test<CR>
" navigate buffers by ctrl-b
nmap <C-b> :bprevious<CR>
nmap <C-B> :bnext<CR>
nnoremap ; :
" no cheating !
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" for damaged keyboards
map <F1> <Esc>
imap <F1> <Esc>
" special chars
nmap <leader>l :set list!<CR>
" search/navigate project structure
nmap <leader>/ :LspWorkspaceSymbol<CR>
nmap <leader>r :LspReferences<CR>
nmap <leader>D :LspDeclaration<CR>
nmap <leader>d :LspDefinition<CR>
nmap <leader>e :LspNextError<CR>
nmap <leader><CR> :LspCodeAction<CR>
nmap <leader>f :Rg
" tree
map <leader>n :NERDTreeToggle<CR>
" quickfix
nmap <leader>q <Plug>window:quickfix:toggle
" completion
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)