2019-02-22 15:50:11 +00:00
|
|
|
" key mappings
|
|
|
|
let mapleader = ","
|
2019-02-24 12:54:41 +00:00
|
|
|
nmap <Leader>s :update<CR>
|
2019-02-22 15:50:11 +00:00
|
|
|
nmap <leader>p :set paste!<CR>
|
|
|
|
nmap <leader>h :set hlsearch!<CR>
|
2022-04-24 10:14:55 +01:00
|
|
|
nmap <leader>t :NvimTreeToggle<CR>
|
2019-02-22 15:50:11 +00:00
|
|
|
|
|
|
|
" navigate buffers by ctrl-b
|
|
|
|
nmap <C-b> :bprevious<CR>
|
2019-02-22 16:08:40 +00:00
|
|
|
nmap <C-B> :bnext<CR>
|
2020-08-16 12:57:07 +01:00
|
|
|
nmap <leader>d :bd<CR>
|
2019-02-22 15:50:11 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
|
2019-02-24 12:54:41 +00:00
|
|
|
" quickfix
|
|
|
|
nmap <leader>q <Plug>window:quickfix:toggle
|
2019-02-23 09:15:44 +00:00
|
|
|
|
2020-09-06 00:21:46 +01:00
|
|
|
" ack
|
|
|
|
cnoreabbrev Ack Ack!
|
|
|
|
nnoremap <Leader>/ :Ack!<Space>
|
|
|
|
nnoremap <silent> [q :cprevious<CR>
|
|
|
|
nnoremap <silent> ]q :cnext<CR>
|
|
|
|
|
|
|
|
" coc
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:show_documentation()
|
|
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
|
|
execute 'h '.expand('<cword>')
|
|
|
|
else
|
|
|
|
call CocAction('doHover')
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ coc#refresh()
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
|
|
|
|
if exists('*complete_info')
|
|
|
|
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
else
|
|
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
endif
|
|
|
|
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
|
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
|
|
xmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
nmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
xmap <leader>a <Plug>(coc-codeaction-selected)
|
|
|
|
nmap <leader>a <Plug>(coc-codeaction-selected)
|
|
|
|
|
|
|
|
nmap <leader>ac <Plug>(coc-codeaction)
|
|
|
|
nmap <leader>qf <Plug>(coc-fix-current)
|
|
|
|
|
|
|
|
xmap if <Plug>(coc-funcobj-i)
|
|
|
|
xmap af <Plug>(coc-funcobj-a)
|
|
|
|
omap if <Plug>(coc-funcobj-i)
|
|
|
|
omap af <Plug>(coc-funcobj-a)
|
|
|
|
|
|
|
|
nmap <silent> <TAB> <Plug>(coc-range-select)
|
|
|
|
xmap <silent> <TAB> <Plug>(coc-range-select)
|
|
|
|
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
|
|
|
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
|
|
|
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
|
|
|
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
|
|
|
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
|
|
|
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
|
|
|
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
|
|
|
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|