nvim: keymappings: Add enhanced helper for ijump

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-06-21 16:43:48 +05:30
parent 76017dc434
commit fd606aa465

View file

@ -173,3 +173,17 @@ inoremap <silent><expr> <TAB>
" 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>
function! s:PromptAndExec(cmd) abort
let ans = input('Type number and <Enter> (empty cancels): ')
if ans !~# '^\s*$'
try
silent execute 'normal! ' . printf(a:cmd, ans)
catch /E387/ "E387: Match is on current line
endtry
endif
endfunction