Moving Around
Basic Cursor Movement
In normal mode, the cursor can be moved with the following keys:
- h - move left
- j - move down
- l - move right
- k - move up
These keys can be prefixed with a number: 10j would jump down 10 lines.
You can jump to around a buffer with the G family of commands:
- gg - Jump to the top of a buffer
- G - Jump to the bottom of a buffer
0-9*
G - Jump to line numberdigit
. For example, 50G jumps to line 50.
It also helps to be able to move around within a line:
- 0 (or Home) - Move to the first character in a line.
- ^ - Move to the first non-blank character of a line.
- $ (or End) - Move to the last character of a line.
Searching
Often, we have an idea of what we're looking for - maybe a keyword or part of a name.
The search motion - / - can be used for moving the cursor to a particular search string:
- /
search-string
Return will search forward, moving the cursor the next instance ofsearch-string
found in the buffer - ?
search-string
Return will search backward, moving the cursor to the previous instance ofsearch-string
- n will move the cursor to the next instance of the last used
search-string
- N will move the cursor to the previous instance of the last used
search-string
- * will search for the next instance of the identifier under the cursor.
- # will search for the previous instance of the identifier under the cursor.
- % will move the cursor to a matching bracket.
While searching with / or ?, matches will be automatically highlighted in the visible editors.
- Control+L will clear the search highlights.
Sneak Mode
Vim's model of modal editing, which Onivim is based off of, was really designed for terminal user interfaces.
However, Onivim provides a graphical user interface - and we want the entirety of our user interface to be keyboard-accessible. If you can't do something via the keyboard, it's a bug!
'Sneak mode' provides a bridge for features that are very visual. By pressing Control+g, you can enter sneak mode:
When sneak mode is active, all visual elements will be tagged with an identifier - typing that identifier will perform the same action as clicking with the mouse.