Created
May 2, 2023 17:28
-
-
Save andlrc/cf2058329ab12413c23b11c78bd80c8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" di-prompt - Prompt for a number after using [I, [D, ]I and ]D | |
" Maintainer: Andreas Louv <andreas@louv.dk> | |
" Date: 01 Apr 2013 | |
" List and jump to define and include | |
" \022\027 is ^R^W (Pasting word under cursor) | |
function! PromptAndExec(cmd) | |
let ans = input('Type number and <Enter> (empty cancels): ', '') | |
if ans =~# '^\s*$' | |
return | |
endif | |
silent execute 'normal! ' . printf(a:cmd, ans) . "\r" | |
endfunction | |
nnoremap [I [I:call PromptAndExec(":ijump! %d \022\027")<Cr> | |
nnoremap ]I ]I:call PromptAndExec(":+1,$ijump! %d \022\027")<Cr> | |
nnoremap [D [D:call PromptAndExec(":djump %d \022\027")<Cr> | |
nnoremap ]D ]D:call PromptAndExec(":+1,$djump %d \022\027")<Cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment