Technology and Art
This short post lists the Neovim (Vim) shortcuts I am getting used to. I’ve recently switched to trying the Vim mode for my IDE needs, and having used Vim previously only for very simple tasks, am having a blast practising the basic Vim shortcuts. Ultimately, I will probably move to doing more IDE-related work in native Vim too.
I’ve also added TMux shortcuts because I’m learning to use that too.
u
/<C-r>
: Undo/Redo.
: Repeat last commandw
/b
: Move forward/backward by a words
refers to a sentence. Thus diw
and daw
deletes a sentence from anywhere inside it, and everything around the sentence, respectively.(
/)
: Jump to previous/next sentencei
/a
/I
/A
: Start editing before/after cursor, before start/after end of line
i
: Considers whitespace as words too, so i2w
selects a word and any whitespace after it.a
: Considers word + whitespace as a text object, so a2w
selects "text1 text2 "
.0
/_
/$
: Go to starting character / starting non-whitespace character / end of lined
: Delete (suffix with counter and text object, like d2w
, dd
)c
: Change (suffix with counter and text object, like c2w
, cc
)r
: Replace (suffix with counter and text object, like r2w
, rr
)y
: Yank (suffix with counter and text object, like y2w
, yy
)
ny$
yanks from cursor to end of line n
times, so n
lines, starting from the current cursor position.F-x
/f-x
: Find character x
before/after*
: Search forward word under cursor/
and ?
: Find string forward/backwardP
/p
: Paste before/after cursorx
: Delete character under cursornG
/ngg
: Go to line number n
G
: Go to end of filei
: “Everything inside” qualifier used in conjunction with other verbs, like diw
, ci"
<C-v>
: Visual Block Mode, use I
to insert en-masse<C-o>
/<C-i>
: Go to old/new positions<C-u>
/<C-d>
: Move up/down half a page{
/}
: Jump forward/back across a contiguous block of text+
/-
: Jump to start of next/previous linex,y<Command>z
: Defines an inclusive range of lines from x
to y
and performs <Command>
with optional argument z
.
m
/t
: Move/Copy range of lines to after z
. Example: 10,20m30
. Single line variants like10m30
also work.x;+/-n
: Defines range of +/-n
starting from line x
.
, .+/-n
: Refers to the current line / Refers to n
lines after/before current line.$
, $+/-n
: Refers to the last line of the document (Compare to going to last character in line in Vim’s Normal mode). +/-n
navigates n
lines after/before last line.%
: Refers to all lines (same as 1,$
)/pattern/
and ?pattern?
: Searches forward and backward for pattern
. This can be used as a location argument in other commands.:<C-p>/:<C-n>
: Moves backwards/forwards through command history.<C-b>?
: View all keybindings<C-b>%
: Horizontal split<C-b>"
: Vertical split<C-b><Arrow Keys>
: Moves across TMux panes<C-b>d
: Detaches from current TMux session<C-b>[
: Enables scroll mode<C-b><Space>
: Enables highlight mode after entering scroll mode. Press <C-b>
to yank highlighted text.<C-b>]
: Pastes copied content to another TMux terminaltmux ls
: Lists running TMux sessionstmux attach -t <SessionID>
: Attaches to specified TMux sessiontmux rename-session -t <OldSessionID> <NewSessionID>
: Renames a TMux session<C-b>,
: Renames current windowtmux new -s <SessionID>
: Creates a new TMux session with given SessionID