In-file navigation

Editors

First thing first, lets split in-file navigation into 3 main categories:

  1. moving - moves the cursor anywhere within visible screen stands still

  2. scrolling - screen moves but cursor's position remains the same

  3. jumping - move anywhere within the current file/buffer, both cursor position and screen change

And here are my main navigation goodies that I use in day-by-day development.

Moving

Cursor moves, screen does not

horizontally by char/column

  • absolute column index: |, 5|

  • single char left/right: h, l

  • multiple chars: 4h, 3l

  • any char on the line: fc, Fc

/img/out-5.gif

horizontally by token/word

  • beginning/end of next token: w, b

  • beginning/end of next word: W, B

  • multiple token: 3w, 3b

  • multiple words: 3W, 3B

  • end of current/next token/word: e, E

/img/out-6.gif

horizontally at beginning/end of line

  • beginning of line: 0

  • end of line: $

  • first non-blank char: ^

  • last non-blank char: g_

/img/out-7.gif

vertically by line

  • single line: "j", "k"

  • multiple lines: "6j", "6k"

/img/out-8.gif

vertically by paragraph

  • up: "}"

  • down: "{"

/img/out-9.gif

on visible screen

  • open/close brace: "%"

  • top/middle/bottom: "H", "M", "L"

  • char/word/line: "C-c m c", "C-c m w", "C-c m l"

/img/out-10.gif

Scrolling

Screen moves, cursor does not

top/middle/bottom

  • top of the screen: "zt"

  • middle of the screen: "zz"

  • bottom of the screen: "zb"

/img/out-11.gif

vertically by one line

  • down: "C-y"

  • up: "C-e"

/img/out-12.gif

horizontally by one column

  • right: "zl"

  • left: "zh"

/img/out-20.gif

horizontally by screen

  • right: "zL"

  • left: "zH"

/img/out-13.gif

Jumping

Both cursor and screen move

at beginning/end of file

  • top: "gg"

  • bottom: "G"

/img/out-14.gif

by full screen

  • down: "C-f"

  • up: "C-b"

/img/out-15.gif

by half page

  • down: "C-d"

  • up: "C-u"

/img/out-16.gif

to line

  • absolute: "34G", "70%"

/img/out-17.gif

mark/jump

  • mark: "mm"

  • beginning of marked line: "'m"

  • marked cursor position: "`m"

  • undo the jump: "''"

/img/out-18.gif

method/function

  • semantic: "C-c j f"

/img/out-19.gif

Happy navigation!!!

comments powered by Disqus