Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

I think the article is missing

  ctrl-y move up 1 line without moving cursor
  ctrl-e move down 1 line without moving cursor
  ctrl-b move up 1 page, placing cursor on last line
  ctrl-f move down 1 page, placing cursor on first line.
These are really useful when looking around without wanting to edit.


I've always used ctrl-e and ctrl-y with `:set scrolloff=2` to make it a bit quicker. It was one of the first things I learned as I found ctrl-d and ctrl-u incredibly jarring and thought there must be another option.


Like TFA I only use ctrl-u and ctrl-d since it's faster than moving one line at time and not as disorienting (in my experience) as moving one full page at a time.

It's also easy to learn since it's [u]p/[d]own.


Don't forget the handy "z commands":

  z<CR>      redraw, cursor line to top of window, cursor on first non-blank
  z-         redraw, cursor line at bottom of window, cursor on first non-blank
  z.         redraw, cursor line to center of window, cursor on first non-blank
(source: :help z)


There's also H (move to the line at the top of the current screenful), L (move to the bottom line in the current screenful), and M (move to the middle line in the current screenful).


nH is also good if you want to go to line n from the top. Works in reverse with nL too :)


Thanks, didn't know about these.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: