yaohunzhanyue / collcetion

6 stars 0 forks source link

How to move screen without moving cursor in Vim? - Stack Overflow #20

Open yaohunzhanyue opened 4 years ago

yaohunzhanyue commented 4 years ago

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?