Here are my Emacs in-file navigation goodies that I use on daily basis, splitted into 3 main categories:
-
moving - cursor moves, screen does not
-
scrolling - screen moves, cursor does not
-
jumping - both cursor and screen move .
1. Moving
Moves the cursor anywhere within visible screen, while the screen stands still.
1.1 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
1.2 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
1.3 horizontally at beginning/end of line
-
beginning of line: 0
-
end of line: $
-
first non-blank char: ^
-
last non-blank char: g_
1.4 vertically by line
-
single line: "j", "k"
-
multiple lines: "6j", "6k"
1.5 vertically by paragraph
-
up: "}"
-
down: "{"
1.6 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"
2. Scrolling
Screen moves but cursor's position remains the same
2.1 top/middle/bottom
-
top of the screen: "zt"
-
middle of the screen: "zz"
-
bottom of the screen: "zb"
2.2 vertically by one line
-
down: "C-y"
-
up: "C-e"
2.3 horizontally by one column
-
right: "zl"
-
left: "zh"
2.4 horizontally by screen
-
right: "zL"
-
left: "zH"
3. Jumping
Jump anywhere within the current file/buffer, both cursor's position and screen change.
3.1 at beginning/end of file
-
top: "gg"
-
bottom: "G"
3.2 by full screen
-
down: "C-f"
-
up: "C-b"
3.3 by half page
-
down: "C-d"
-
up: "C-u"
3.4 to line
-
absolute: "34G", "70%"
3.5 mark/jump
-
mark: "mm"
-
beginning of marked line: "'m"
-
marked cursor position: "`m"
-
undo the jump: "''"
3.6 method/function
-
semantic: "C-c j f"
Happy navigation!!!