In Vim you can use the [I
command to list all of the locations where a specified function, class or struct is declared or used. Is there a simple shortcut to open one of the files in this resulting list in Vim? I'd prefer not to have to type in the full filename and line number.
You can also use keyboard arrow keys for navigation in a file. You can also repeat the operation for N times in Vim. For example, if you want to move down by 5 lines, then write '5j'. Vim also allows users to navigate in a file to other positions instead of only the upward or download.
Basic searching Type ggn to jump to the first match, or GN to jump to the last.
If we are in the vim editor, then simply do this, “Press the ENTER key, write the Line number, and press Shift+ g”: Again the output is the same.
I remembered the old gF trick, that works great.
Shameless rip from vim tips:
The following commands open the file with the cursor on the specified line number:
gF open in the same window
<c-w>F open in a new window (Ctrl-w F)
<c-w>gF open in a new tab (Ctrl-w gF)
When such file-name/line number pairs are the result of compiling code, the following commands are also useful:
:help :cn
:help :cl
:help :cfile
The file:line plugin allows you to use combinations of file name and line number, like global.h:123, as an argument to Vim. When you open file:line, the script checks if file exists and line is a number. If so, Vim opens file at the correct line line number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With