The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 11: | Line 11: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | Press < |
+ | Press <tt>[I</tt> to display all lines that contain the keyword under the cursor. Lines from the current file, and from included files, are listed. Another command (see the [[#References|references below]]) allows you to jump to one of the displayed occurrences. |
− | Here are two functions to simplify the process. With the mappings shown (and the default backspace Leader key) you can press < |
+ | Here are two functions to simplify the process. With the mappings shown (and the default backspace Leader key) you can press <tt>\j</tt> to list occurrences of the keyword under the cursor. You are then prompted to enter the number of an item, in order to jump to that occurrence. Alternatively, press <tt>\p</tt> for a prompt allowing you to enter the keyword. |
<pre> |
<pre> |
||
Line 49: | Line 49: | ||
</pre> |
</pre> |
||
− | Paste the code above into a file, save the file, then enter the command < |
+ | Paste the code above into a file, save the file, then enter the command <tt>:so %</tt> (source current file). Then put the cursor on a word in any file and press <tt>\j</tt> to list occurrences, and jump to the selected occurrence. |
==References== |
==References== |
||
Line 59: | Line 59: | ||
==Comments== |
==Comments== |
||
− | If you would prefer to modify < |
+ | If you would prefer to modify <tt>[I</tt> to prompt for a number to jump to the following map does so: |
<code>nnoremap [I [I:let nr = input("Which one: ")<Bar>if nr != ""<Bar>exe "silent! normal " . nr ."[\t"<Bar>endif<CR></code> |
<code>nnoremap [I [I:let nr = input("Which one: ")<Bar>if nr != ""<Bar>exe "silent! normal " . nr ."[\t"<Bar>endif<CR></code> |
||
− | and again for < |
+ | and again for <tt>]I</tt> |
<code>nnoremap ]I ]I:let nr = input("Which one: ")<Bar>if nr != ""<Bar>exe "silent! normal " . nr ."]\t"<Bar>endif<CR></code> |
<code>nnoremap ]I ]I:let nr = input("Which one: ")<Bar>if nr != ""<Bar>exe "silent! normal " . nr ."]\t"<Bar>endif<CR></code> |