I recently discovered Ctrl+E and Ctrl+Y shortcuts for Vim that respectively move the screen up and down with a one line step, without moving the cursor.
Do you know any command that leaves the cursor where it is but moves the screen so that the line which has the cursor becomes the first line? (having a command for the last line would be a nice bonus).
I can achieve this by manually pressing Ctrl+E (or Ctrl+Y) the proper number of times, but having a command that somehow does this directly would be nice.
Any ideas?
In Vim, Ctrl e is normally used to scroll the window up, and it can keep scrolling the window to the point where the bottom edge of the file goes above the bottom edge of the window. This enables us to center the bottom of a file in the middle of our window, allowing for easier viewing.
You can make Vim scroll the text using the shifted up/down arrows by mapping Shift-Up to Ctrl-Y and Shift-Down to Ctrl-E. Shift-Down will then scroll down (like moving a scroll-bar down, or like moving a cursor at the bottom of a window down), and Shift-Up will then scroll up (like moving a scroll-bar up, etc).
To flip your screen, hit the Ctrl + Alt + up/down arrow keys at the same time. Hold down and press the Ctrl + Alt + Up arrow. Holding down and pressing these keys will rotate your screen to its default position, which is the horizontal orientation. Hold down and press the Ctrl + Alt + Down arrow.
vim
!) 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