Moving around
- Vim (and vi in general) has many commands for moving around.
- A complete listing of them can be found in :help motion.txt.
- Examples:
-
- h/<Left>/<Backspace>/CTRL-H - Left
- l/<Right>/<Space> - Right
- k/<Up>/CTRL-P - Up
- j/<Down>/CTRL-J/CTRL-N - Down
- 0 - To the beginning of the line
- $ - To the end of the line
- ^ - To the first non-blank character in the line
- % - To a matching parens (a favourite of mine)
- gg - To the beginning of the file
- G - To the end of the file
- (/) - previous/next sentence
- {/} - previous/next paragraphs
- Some of these commands can be preceded by a number which repeat them several times.
-
- For instance 5h moves 5 character to the left
- And 100gg moves to line number 100.