nvim: Refactor out asyncdo & completion keymappings

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-07-14 18:17:20 +05:30
parent 94d5c03fd7
commit 0abeb9d927
3 changed files with 22 additions and 22 deletions

View file

@ -0,0 +1,7 @@
" Async Make mappings
nnoremap <LocalLeader>b :Make<CR>
nnoremap <LocalLeader>B :LMake<CR>
" Asynchronous make
command! -bang -nargs=* -complete=file Make call asyncdo#run(<bang>0, &makeprg, <f-args>)
command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(<bang>0, &makeprg, <f-args>)

View file

@ -0,0 +1,14 @@
" For nvim-completion
imap <C-j> <Plug>(completion_next_source)
imap <C-k> <Plug>(completion_prev_source)
" Tab completion. Taken from nvim-completion README.
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>" :
\ completion#trigger_completion()

View file

@ -7,9 +7,6 @@ inoremap <Esc> <Nop>
cnoremap <Esc> <Nop>
" Use Q to execute default register.
nnoremap Q <Nop>
" Async Make mappings
nnoremap <LocalLeader>b :Make<CR>
nnoremap <LocalLeader>B :LMake<CR>
" Save
nnoremap <Leader>w <Esc>:w<CR>
@ -76,6 +73,7 @@ nnoremap zms :set foldmethod=syntax<CR>
tnoremap jk <C-\><C-n>
nnoremap <silent> <C-z> :ToggleTerminal<Enter>
tnoremap <silent> <C-z> <C-\><C-n>:ToggleTerminal<Enter>
" Key bindings to move between window splits
for key in range(0, 9)
execute 'nnoremap <Space>'.key key.'<C-w>w'
@ -120,25 +118,6 @@ vnoremap . :norm.<CR>
" Go to the last file we changed
nnoremap <BS> <C-^>
" For nvim-completion
imap <C-j> <Plug>(completion_next_source)
imap <C-k> <Plug>(completion_prev_source)
" Tab completion. Taken from nvim-completion README.
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>" :
\ completion#trigger_completion()
" Asynchronous make
command! -bang -nargs=* -complete=file Make call asyncdo#run(<bang>0, &makeprg, <f-args>)
command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(<bang>0, &makeprg, <f-args>)
nnoremap [i [I:call <SID>PromptAndExec(":ijump! %d \022\027\015")<CR>
nnoremap ]i ]I:call <SID>PromptAndExec(":+1,$ijump! %d \022\027\015")<CR>