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>
精彩评论