Minimum plugins used.
Check where the configuration lives on your system. On macOS it's in ~/.config/nvim.
Everything inside the nvim folder in this repository should be placed in ~/.config/nvim.
Leader key: Space. The Leader key is pressed before a keybinding combination.
From netrw:
-
Create a file:
f f. -
Create a directory:
f d. -
Edit the name of the file/directory under the cursor:
f e. -
Delete the file or empty directory under the cursor:
f r.
From netrw:
-
Mark a directory as the target:
Shift Tab. This is required when moving or copying files to that directory. -
Mark/unmark a file or directory:
Tab. -
Unmark all marked files and directories:
Leader Tab. -
Copy marked files/directories to the target directory:
f c. -
Copy marked files/directories to the directory under the cursor:
f C. -
Move marked files/directories to the target directory:
f x. -
Move marked files/directories to the directory under the cursor:
f X. -
Run a shell command on marked files/directories:
f ;. For example, mark a non-empty directory, use f ;, then type rm -r to delete it.
From netrw:
-
Bookmark the current directory:
f b. -
Remove the most recent bookmark:
f b r. -
Go to the previous bookmarked directory:
f b g. -
Show a list of marked files:
f l m. -
Change to the directory under the cursor:
c d. -
Move up one directory:
-. -
Open the file tree (from a file):
Leader e. -
Open a file in a new tab: place the cursor on a file/directory and press
t. -
Navigate to an open tab by number:
Ngt, where N is the tab number.
-
Search in files:
Leader s f. -
Search in git files:
Leader s f g. -
Search for the word under the cursor in files:
Leader s w. -
Search by grep:
Leader s g. -
Find recently opened files:
Leader ?.
-
Show a list of errors in the current file:
Leader s i. -
Search for a pattern in the file:
?. -
Search for the word under the cursor:
*. -
Go to a specific line in the file:
:<line number>. -
Format the file according to formatting rules:
Leader f m. -
Line-comment selected lines:
g c c. -
Block-comment selected lines:
g b c. -
Go to the very top of the file:
g g. -
Go to the very bottom of the file:
G. -
Toggle autocomplete in insert mode:
Shift Tab. -
Scroll down:
Ctrl d. -
Scroll up:
Ctrl u. -
Copy to clipboard:
" + y. -
Add a multi-line prefix:
Leader a a, add text to the beginning of the first line,Esc. -
Remove a multi-line prefix:
Leader a r, select the prefix,x. -
Split vertically: press
von a file in netrw. -
Split vertically:
Leader vfrom a file. -
Open the current file in a new tab:
Leader tfrom a file. -
Increase window width:
Leader >. -
Decrease window width:
Leader <. -
Equalize split sizes:
Leader =. -
Place the cursor on a number in normal mode and press
Ato increment orXto decrement it.
-
Hover over a variable/function to show details:
K. -
Go to definition:
g d. -
Show code actions:
Leader c a.
-
Open diff view:
Leader d v. -
Close diff view:
Leader d v c. -
Open diff view for the current file:
Leader d v f.
For more information about resolving merge conflicts in diff view, press g ? while in diff view.
- Open the package manager:
:Mason.
For more information about plugins, see the Mason documentation.
e - jump forwards to the end of a word.
b - jump backward to the end of a word.
% - move the cursor to a matching character (default supported pairs: (), {}, [] — use :h matchpairs in Vim for more info).
0 - jump to the start of the line.
^ - jump to the first non-blank character of the line.
$ - jump to the end of the line.
g_ - jump to the last non-blank character of the line.
gg - go to the first line of the document.
G - go to the last line of the document.
} - jump to the next paragraph (or function/block when editing code).
{ - jump to the previous paragraph (or function/block when editing code).
i - insert before the cursor.
I - insert at the beginning of the line.
a - insert (append) after the cursor.
A - insert (append) at the end of the line.
o - append (open) a new line below the current line.
O - append (open) a new line above the current line.
ea - insert (append) at the end of the word.
Ctrl + w - delete the word before the cursor.
Ctrl + t - indent (move right) the line one shiftwidth.
Ctrl + d - de-indent (move left) the line one shiftwidth.
Ctrl + n - insert the next autocomplete match before the cursor.
Ctrl + p - insert the previous autocomplete match before the cursor.
r - replace a single character.
R - replace more than one character until ESC is pressed.
J - join the line below to the current one with one space in between.
cc - change (replace) the entire line.
c$ or C - change (replace) to the end of the line.
cw or ce - change (replace) to the end of the word.
s - delete the character and substitute text (same as cl).
S - delete the line and substitute text (same as cc).
u - undo.
Ctrl + r - redo.
. - repeat the last command.
v - start visual mode; mark lines, then run a command (e.g. y to yank).
V - start linewise visual mode.
Ctrl + v - start visual block mode.
a( - a block with ().
a{ - a block with {}.
at - a block with <> tags.
i( - inner block with ().
i{ - inner block with {}.
it - inner block with <> tags.
> - shift text right.
< - shift text left.
y - yank (copy) marked text.
d - delete marked text.
~ - switch case.
u - change marked text to lowercase.
U - change marked text to uppercase.
ma - set the current position as mark A.
`a - jump to the position of mark A.
`. - go to the position of the last change in this file.
g, - go to a newer position in the change list.
g; - go to an older position in the change list.
qa - record macro a.
q - stop recording the macro.
@a - run macro a.
@@ - rerun the last run macro.
yy - yank (copy) a line.
Nyy - yank (copy) N lines downward.
Ny<up|down> - yank (copy) N lines up or down.
yw - yank (copy) characters from the cursor position to the start of the next word.
yiw - yank (copy) the word under the cursor.
y$ or Y - yank (copy) to the end of the line.
p - put (paste) clipboard contents after the cursor.
P - put (paste) before the cursor.
dd - delete (cut) a line.
Ndd - delete (cut) N lines downward.
Nd<up|down> - delete (cut) N lines up or down.
dw - delete (cut) characters from the cursor position to the start of the next word.
:g/{pattern}/d - delete all lines containing a pattern.
:g!/{pattern}/d - delete all lines not containing a pattern.
d$ or D - delete (cut) to the end of the line.
x - delete (cut) a character.
>> - indent (move right) the line one shiftwidth.
<< - de-indent (move left) the line one shiftwidth.
>% - indent a block with () or {} (cursor on brace).
<% - de-indent a block with () or {} (cursor on brace).
:w - write (save) the file without exiting.
:wq - write (save) and quit.
:q - quit (fails if there are unsaved changes).
:qa - quit all (fails if there are unsaved changes).
:q! - quit and discard unsaved changes.
:wqa - write (save) and quit all tabs.
/pattern - search for a pattern.
?pattern - search backward for a pattern.
n - go to the next match.
N - go to the previous match.
:%s/old/new/g - replace all occurrences of old with new throughout the file.
:%s/old/new/gc - replace all occurrences with confirmation.
:%s/old/new/gi - replace all occurrences, case-insensitive.
:%s/old/new/gI - replace all occurrences, case-sensitive.
:%s/old/new/gIc - replace all occurrences, case-sensitive, with confirmation.
You can find more Vim commands here.