dotfiles/.vimrc.keymap
Cyryl Płotnicki f655bf4ddf add lsp keymaps
2019-02-24 12:54:41 +00:00

56 lines
1.2 KiB
Plaintext
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><CR> :LspCodeAction<CR>
" 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)