Reposition the current line
You will often find yourself navigating a file that doesn’t entirely fit within your window’s viewport. The smaller your monitor and the larger your file, the more likely this will occur. In these cases, it might more comfortable to have the viewport shifted, moving the current line. With some quick key presses in normal mode, you can move your current line to the top, middle, or bottom of the screen as easy as so:
ztrepositions the viewport so the current line is at the top, with one extra space above. (Just remember t for t op.)
zzrepositions the viewport so the current line is in the middle.
zbrepositions the viewport so the current line is at the bottom, with one extra space below. (Just remember b for b ottom.)
Here’s a quick screencast showing these in use:
First we move the current line to the top of the window with
zt, then to the middle, with
zz, then lastly to the bottom with
zb. You can see how repositioning can be helpful to quickly expose portions above or below your working line.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?