-
v : visual mode (character by character)
-
V : visual line mode (entire lines)
-
CTRL+V : visual block (rectangular selection)
-
o : edit the other end of the selection
-
O : edit the other set of corners in visual block mode
-
:Ex /
<leader>pv
: switches to netrw mode -
% : create a file
-
d : create a directory
-
:![shell command\]
: executes a shell command -
:w
[name]` : write the file/selection as a new file -
Save selection as a new file name
-
v for visual mode
-
motions to select text
-
<ESC>
-
:w FILE
: saves the selection as new FILE
-
-
:r FILENAME
: retrieves the content of a file and inserts it after the cursor -
:r :![shell commands]
: inserts the output of a shell command -
CTRL+D : code completion for the command
-
CTRL+W then q: closes the current window
-
CTRL+W then c: closes the current window, with a warning if it’s the last window
-
CTRL+W then o: closes all the [o]ther windows
-
:sp
: horizontal split opening a blank new window -
:sp + optionnal file path
: horizontal split loading the new file in the new window -
:vsp
: vertical split opening a blank new window -
:vsp + optionnal file path
: vertical split loading the new file in the new window -
CTRL+W then s : split the current window horizontally, opens the same buffer
-
CTRL+W then v : split the current window vertically, opens the same buffer
-
CTRL+W then v : split the current window horizontally, opens a blank buffer
-
CTRL+W then =: distributes the available space within a nesting level
-
CTRL+W then _: gives the maximum vertical space
-
CTRL+W then |: gives the maximum horizontal space
-
CTRL+W then w: goes to the next window
-
CTRL+W then @: goes to the previous window
-
CTRL+W then l: goes towards top left
-
CTRL+W then b: goes towards bottom right
-
CTRL+W CTRL+W jumps to another window
-
CTRL+W then x: exchanges current window with its neighbour window
-
CTRL+W then [number] then x: exchanges current window with the n-th window (
:buffers
to have the numbers)
Basic formula : operator [number] motion
-
h: left
-
l: right
-
K: up
-
j: down (mnemonic : J looks like a down arrow)
-
w: until the start of the next word, excluding its first character. Puts cursor on the first character of the next word
-
b: moves backwards one word
-
W: moves to the begining of the next group of WORDS (ie any group of character that is not a space, like_this)
-
e: to the end of the current word, including the last character. Puts the cursor on the last character of the word / the space after the deleted word
-
ge: moves to the end of the previous word
-
gE: moves to the end of the previous WORD
-
$: to the end of the line, including its last character
-
0: beginning of the line
-
_ or ^: goes to the first non blank character
-
f then [character: jumps forward on the character
-
F then [character: jumps backwards on the character
-
t then [character: jumps forward to the character (ie the character just before)
-
t then [character: jumps backwards to the character (ie the character just after)
-
, / ;: jumps to the previous / next character
-
% : moves to the matching
[] () {}
. If not on such caracter, will find the first one, then move to its match.
-
CTRL+G : displays a text in the status bar saying how many line the buffer has, and where we are
-
G: moves to the bottom of the file
-
[NUMBER]
G: go to line number x, eg:12G
-
gg moves to the top of the file
-
H: moves to the first visible line on the screen
-
M: moves to the middle of the visible lines (ie middle of the screen)
-
L: moves to the last visible line
-
CTRL+B: scrolls up one full screen
-
CTRL+u: scrolls half a screen up
-
CTRL+e: scrolls up one line
-
CTRL+y: scrolls down one line
-
CTRL+d: scrolls half a screen down
-
CTRL+f: scrolls down a full screen
-
zt: scrolls to the line with the cursor, placing it at the top
-
zz: scrolls to the line with the cursor, placing it in the middle
-
zb: scrolls to the line with the cursor, placing it at the bottom
-
``: go back to previous mark
-
CTRL+o: moves to previous mark
-
CTRL+i: moves to next mark
-
m[a-z]: sets a named mark
-
`[a-z]: moves to the named mark
-
:set ic
/:set noic
: sets / removes ignore case mode-
It’s also possible to use
\c
at the end of the command, like/search\c
-
-
:set hls is
/:set nohls
: sets / removes highlighting of search results -
/[Text] + <Enter : searches for [Text] forward and goes to the next occurence
-
?[Text] + Enter : searches for [Text] backwards and goes to the next occurence
-
n : searches the next occurence (same direction)
-
N : searches the next occurence (reverse direction)
-
% : finds matching ), ] or }
-
CRL+o : moves back to older positions
-
CTRL+i : moves back to newer positions
-
:s/[text_to_replace]/[replacement]/
: replaces the next occurrence only -
:s/[text_to_replace]/[replacement]/g
: replaces all occurrences in the line -
:#,#s/[text_to_replace]/[replacement]/g
: replaces all occurrences between line x and y, inclusive-
:%s/[text_to_replace]/[replacement]/g
: replaces all occurrences in the whole file (no prompt) -
:%s/[text_to_replace]/[replacement]/gc
: replaces all occurrences in the whole file (with prompt)
-
(y/n/a/q/l/^E/^Y) :
-
y: confirm the substitution of this match
-
n: skip this match
-
a: substitutes this and all remaining matches
-
q: quits substitution mode
-
l: substitutes this match and quit ("last" match)
-
CTRL+E: scrolls down while staying in substitution mode
-
CTRL+Y: scrolls up while staying in substitution mode
-
.: repeat the last change
-
x : deletes the character under the cursor
-
X: deletes the character left of the cursor
-
BACKSPACE : deletes the character before the cursor
-
dw: deletes the word under the cursor
-
D or d$ : deletes from cursor until end of line
-
dd : deletes the entire line
-
J: deletes line break join the line with the line below
-
i : switches to insert mode, inserts before the cursor
-
I : switches to insert mode, inserts at the beginning of the line
-
a: switches to insert mode, inserts after the cursor
-
A: switches to insert mode, inserts at the end of the line
-
o: opens (adds) a line below the current line and switches to insert mode
-
O: opens (adds) a line above the current line and switches to insert mode
-
r then [character] : replaces one character (stays in normal mode)
-
R then [characters] : switches to replace Mode, typing text overwrites existing text
-
c then [motion] : changes (delete + insert mode) text until the end of the word/line, and switches to insert mode
-
C: changes (delete + insert mode) until the end of the line
-
cc / S: changes a whole line
-
s: changes the character under the cursor
-
y: copy text
-
Y: copy until the end of the line
-
yy: copy the entire line
-
LEADER y: copy to OS clipboard (+)
-
u: undo last character action
-
U: undo all edits on a whole line
-
LEADER u: Undotree toggle UI
-
CONTROL+r: redo
-
a : (”a” text object) text object + following white space or character (), []
-
i : (inner) text object without white space
-
CONTROL+SPACE: trigger auto-complete
-
CONTROL+p: previous autocompletion
-
CONTROL+n: next autocompletion
-
CONTROL+y: confirm auto-complete
-
CONTROL+e: abort auto-complete
-
LEADER f: formats buffer
-
LEADER c a: view code actions
-
K: hover menu (call twice to jump into the hover window)
-
LEADER r n: rename
-
LEADER d l: view diagnostic floating window (when over a diagnostic)
-
[d: next diagnostic
-
] d: previous diagnostic
-
LEADER D: view type definition
-
g D: go to declaration
-
g d: go to definition
-
g i: go to implementation
-
CRL+o : moves back to calling point
-
CTRL+i : moves back to the definition
-
-
g r : list references in a new buffer
-
LEADER d s : list document symbols in a new buffer
-
<C-h> : view signature help
-
<M-y> : accept the whole suggestion
-
<M-u> : accept line
-
<M-i> : accept word
-
<M-[> : previous suggestion
-
<M-]> : next suggestion
-
<C-]> : dismiss
Shortcuts match Visual Source Code.
-
F9 : toggle breakpoint
-
SHIFT+F5 : terminate debug
-
F5 : continue
-
F10 : step over
-
F11: step into
-
SHIFT+F11: step out