Is there a Vim command to move to the middle of a huge file without calculating (total lines/2)
and using j
? Something like zz
, zt
, or zb
, which moves only around the current screen?
Using windows. Ctrl-W w to switch between open windows, and Ctrl-W h (or j or k or l ) to navigate through open windows. Ctrl-W c to close the current window, and Ctrl-W o to close all windows except the current one. Starting vim with a -o or -O flag opens each file in its own split.
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.
You can use one of the features that vim borrowed from elvis: it accepts a percentage of the file directly. For example, typing
50%
jumps to the middle of the file.
In vim, if you enter
:h up-down-motions
that leads to the section describing the feature:
{count}% Go to {count} percentage in the file, on the first
non-blank in the line |linewise|. To compute the new
line number this formula is used:
({count} * number-of-lines + 99) / 100
See also 'startofline' option. {not in Vi}
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