x- delete characterd...- delete motiondd- delete line (or2ddfor 2 lines)y...- copy motion (yank)yy- yank line (or2yyfor 2 lines)p/P- paste (put) (pafter cursor,Pbefore cursor)u- undoU- undo all changes on line<C-r>- redor...replace current characterRenter replace mode (overtype)c...change motion (delete and enter insert mode)v- open visual modeV- open visual line mode<C-V>- select line<C-v>- open visual block modeo/O- insert a new line, move cursor to that line, and open insert modei/I- enter insert mode (Iat beginning of line)
| name | emacs keybind | vim keybind |
|---|---|---|
| beginning of line | C-a |
^ 0 |
| end of line | C-e |
$ |
| beginning of file | M-< |
gg |
| end of file | M-> |
G |
| specific line | G + line number |
|
| beginning of next word | M-f |
w / W |
| end of current word | e / E |
|
| beginning of current word | M-b |
b / B |
| next paragraph | M-} |
} |
| previous paragraph | M-{ |
{ |
| previous cursor location | <C-o> |
|
| next cursor location | <C-i> |
|
| search | C-s |
/ / ? |
| next search result | n |
|
| previous search result | C-r |
N |
| page up | C-v |
<C-b> |
| page down | M-v |
<C-f> |
| scroll cursor centered | C-l |
zz |
| scroll cursor top | C-l |
zt |
| scroll cursor botton | C-l |
zb |
| name | emacs cmd | emacs keybind | vim cmd | vim keybind |
|---|---|---|---|---|
| open file | find-file |
C-x C-f |
:find |
N/A |
| hide everything else | delete-other-windows |
C-x 1 |
:only :on |
<C-W>o |
| delete window | delete-window |
C-x 0 |
:close |
<C-W>c |
| delete window | delete-window |
C-x 0 |
:close |
<C-W>c |
| go to next window | other-window |
C-x o |
N/A | <C-W>w |
| split top/bottom | split-window-vertically |
C-x 2 |
:split |
<C-W>s |
| split left/right | split-window-horizontally |
C-x 3 |
:vsplit |
<C-W>v |
| list buffers | ibuffer | C-x C-b |
:buffers :ls |
N/A |
| open buffer | switch-to-buffer |
C-x b |
:buffer :b |
N/A |
| swap to last buffer | switch-to-prev-buffer |
N/A | :b# |
<C-6> |
| equalize window sizes | balance-windows |
C-x + |
N/A | <C-=> |
-
:s/foo/bar/- replace 1st occurrence on the current line offoowithbar -
:%s/foo/bar/- replace 1st occurrence after the cursor offoowithbar -
:5,10s/foo/bar/- replace 1st occurrence between lines 5 and 10 offoowithbar -
:nohlsearch/:nohl/:noh- stop highlighting search -
add
gto handle all occurrences within the given range -
add
gcto handle all occurrences but confirm each time -
you can also start a find/replace limited to selected text in visual mode
-
also see the
Rkeybind for replace/overtype
:!ls- execute thelscommand and show output in message pager- if there is a selection in visual mode, pass the currently selected text as stdin to the
lscommand and replace the selection with the command's output
- if there is a selection in visual mode, pass the currently selected text as stdin to the
:w !ls- pass the currently selected text (or the entire file) as stdin to thelscommand and show the output as a message:w PATH_HERE- write the contents of the open buffer to a file located atPATH_HERE- you can also write a specific text selection from visual mode
:q- quit:r- insert a file's contents:r !ls- insert the output of thelscommand
- usage:
:set OPTION_NAME_HERE - note: prepend option with
noto turn off - note: prepend option with
invto invert (toggle) ignorecase/ichlsearch/hlsincsearch/isnumber/nu
C-d- show tabulated command completion options
- emacs:
where-is/C-h w - nvim:
- if builtin keybind:
help indexand then grep - else (mapped):
:new,:put =execute('COMMAND_HERE'), (where COMMAND isnmap/imap/vmapdepending on mode ormapfor all modes) and then grep
- if builtin keybind:
- emacs:
describe-key/C-h k - nvim:
- if builtin keybind:
:help KEYBIND_HERE(example:CTRL-W_w) - else (mapped):
:verbose map KEYBIND_HERE(example:<C-W>w)
- if builtin keybind: