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.
.: Repeat last command
b: Move forward/backward by a word
srefers to a sentence. Thus
dawdeletes a sentence from anywhere inside it, and everything around the sentence, respectively.
): Jump to previous/next sentence
A: Start editing before/after cursor, before start/after end of line
i: Considers whitespace as words too, so
i2wselects a word and any whitespace after it.
a: Considers word + whitespace as a text object, so
"text1 text2 ".
$: Go to starting character / starting non-whitespace character / end of line
d: Delete (suffix with counter and text object, like
c: Change (suffix with counter and text object, like
r: Replace (suffix with counter and text object, like
y: Yank (suffix with counter and text object, like
ny$yanks from cursor to end of line
nlines, starting from the current cursor position.
f-x: Find character
*: Search forward word under cursor
?: Find string forward/backward
p: Paste before/after cursor
x: Delete character under cursor
ngg: Go to line number
G: Go to end of file
i: “Everything inside” qualifier used in conjunction with other verbs, like
<C-v>: Visual Block Mode, use
Ito insert en-masse
<C-i>: Go to old/new positions
<C-d>: Move up/down half a page
}: Jump forward/back across a contiguous block of text
-: Jump to start of next/previous line
x,y<Command>z: Defines an inclusive range of lines from
<Command>with optional argument
t: Move/Copy range of lines to after
10,20m30. Single line variants like
x;+/-n: Defines range of
+/-nstarting from line
.+/-n: Refers to the current line / Refers to
nlines 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).
nlines after/before last line.
%: Refers to all lines (same as
?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 terminal
tmux ls: Lists running TMux sessions
tmux attach -t <SessionID>: Attaches to specified TMux session
tmux rename-session -t <OldSessionID> <NewSessionID>: Renames a TMux session
<C-b>,: Renames current window
tmux new -s <SessionID>: Creates a new TMux session with given