开发者

How to use [I in vim

开发者 https://www.devze.com 2022-12-25 07:45 出处:网络
The vim command [I shows a list of declarations.How to do I navigate to one of the items in th开发者_运维技巧is list?As far as I know (and by briefly glancing at the manual) - that\'s not possible wit

The vim command [I shows a list of declarations. How to do I navigate to one of the items in th开发者_运维技巧is list?


As far as I know (and by briefly glancing at the manual) - that's not possible with those particular commands available.

However, you can use :vimgrep to sort of achieve what you're after e.g.:-

:vimgrep <C-R><C-W> %

And then just use the quickfix list to browse the matches as normal:-

:copen, :cnext, :cprev, etc.


Take note of the line numbers. You can use 100G to jump to line 100, 500G will jump to line 500, etc.

You could also just press * repeatedly to move through the matches (or # to move backwards).


The following snippet might be what you are looking for. It shows the list of declarations by [I and asks you in the same step to enter the number of the item you want to jump to:

nnoremap <silent> [I [I:let nr = input("Item: ")<Bar>if nr != ''<Bar>exe "normal " . nr ."[\t"<Bar>endif<CR>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号