Neovim tips and life hacks that significantly improved my productivity

I’ve been using Neovim for a couple months now and by now have went through the entire Wiki.

I would like to share some of my most loved tricks that have really skyrocketed my productivity.

Basic Navigation

CommandDescription
hMove left by one character
lMove right by one character
jMove down by one line
kMove up by one line
+Move to the next non-whitespace character on line
-Move to the previous non-whitespace character
^Move to the first non-whitespace character
_Move to the first character on the line (takes count)
$Move to the last character on the line
GMove to the end of the file
ggMove to the beginning of the file
40ggJump to line 40
%Jump to matching parenthesis or bracket
t{char}Jump before the next occurrence of {char}
f{char}Jump to the next occurrence of {char}
T{char}Jump before the previous occurrence of {char}
F{char}Jump to the previous occurrence of {char}
,Repeat t, T, f, F in opposite direction
;Repeat t, T, f, F in same direction

Searching

CommandDescription
/patternSearch forward
?patternSearch backward
#Search backward for identifier under cursor
*Search forward for identifier under cursor
/pattern/ePlace cursor on last character of match
/pattern/e+1Place cursor one character to the right of match
/apple\CCase-sensitive search
:%s/pattern//nCount occurrences of pattern
/\%VSearch inside visual selection

Editing

CommandDescription
iInsert at cursor
IInsert at start of line
aAppend after cursor
AAppend at end of line
giInsert at last edit position
oOpen new line below and enter insert mode
OOpen new line above and enter insert mode
r{char}Replace character under cursor
JJoin line with next one
gJJoin lines without inserting space
xpSwap two characters
DDelete to end of line
YYank to end of line
CChange to end of line
gqWrap long lines

Case Modification

CommandDescription
guuMake current line lowercase
gUUMake current line uppercase
g~~Toggle case of current line
guOperator to make text lowercase
gUOperator to make text uppercase
g~Operator to toggle case

Copying & Deleting

CommandDescription
yyYank entire line
ddDelete entire line
yibYank inside ()
d/helloDelete until “hello”
d/hello/eDelete up to and including “hello”
dkDelete current and previous line
djDelete current and next line
gpPaste like p but leave cursor after
gPPaste like P but leave cursor after

Visual Mode Tricks

CommandDescription
CTRL vVisual block mode
<Dedent selected text
>Indent selected text
IInsert text at beginning of each line (block mode)
$AAppend text at end of each line (block mode)
oJump to the other end of the selection
gvReselect last visual selection
g CTRL vIncrement each line numerically

Window Management

CommandDescription
CTRL wxSwap windows
CTRL wvSplit window vertically
CTRL wsSplit window horizontally
CTRL wqQuit window
CTRL w=Equalize window sizes

Useful Operators & Motions

CommandDescription
vapSelect around paragraph
[{Move to previous unmatched {
]{Move to next unmatched {
[( Move to previous unmatched (
](Move to next unmatched (
g;Jump to previous insert location
g,Jump to next insert location
''Jump to position before last jump

Command-line Mode Tricks

CommandDescription
CTRL r+Paste from system clipboard
CTRL uDelete all characters
CTRL gNext match in search results
CTRL tPrevious match in search results
:%normApply command to every line (:%norm $ciwhello)
:g/^#/dDelete all comments from a Bash file
:g/foo/s/bar/baz/gReplace “bar” with “baz” in lines containing “foo”
g&Repeat last substitution

Clipboard & Registers

CommandDescription
gxOpen link under cursor
gfOpen file under cursor
If unnamedplus is set, system clipboard won’t overwrite yank buffer

Miscellaneous

CommandDescription
CTRL gShow filename and line count
zzCenter cursor on screen (middle)
ztCursor to top of screen
zbCursor to bottom of screen
:centerCenter text
gaShow character info under cursor
g?ROT13 encode input
CTRL aIncrement number under cursor
CTRL xDecrement number under cursor
:sort uSort lines uniquely
:sort nSort lines numerically
<C-f>Edit Ex command in full-page view
_Move to first character on line, accepts a motion