VIM SHORTCUT

Description

ALL VIM (terminal text editor) shortcuts you need to know to be a coding ninja
Fen Pin
Flashcards by Fen Pin, updated more than 1 year ago
Fen Pin
Created by Fen Pin over 7 years ago
24
0

Resource summary

Question Answer
:help open help for keyboard
:o open file
:saveas save a file as
:close close current page
K open man page for the word under cursor
i insert before the cursor
h move cursor to left
j move cursor down
k " " up
l " " right
H "" top screen
M "" middle of the screen
I insert at the beginning of the line
a insert (append) after the cursor
A insert at the end of the line
o append (open) a new line below the current one
O append a new line above the current one
ea insert at the end of the word
esc exit insert mode
r replace
J join line below the current one
cc change (replace) the entire line
cw change to the end of the word
c$ change to the end of the line
s delete character and substitute text
S delete line and substitute text (as cc)
xp transpose two letters (dlt n paste actually)
u undo
ctrl+r redo
. repeat cmd
yy yank (copy) a line
nbr+yy yank nbr lines
yw yank the characters of the word from the cursor position to the next word
y$ yank "till the end of the line
p put
P Put
dd delete
nbr+dd delete (cut actually) nbr of lines
dw delete the characters of word from the cursor pos to the start of the next word
D delete to the end of the line
d$ delete to the end of the line
x cut character
:w write save the file but don't exit
:w !sudo tee % write the current file using sudo
:wq / :x / ZZ write and quit
:q quit fails in case of unsaved changed
:q! / ZQ quit and throw away unsaved changed
/patrn search for patrn
?pattern search backward for patrn
\vpatrn very magic patrn non alphanum characters are interpreted as special regex* no escaping needed
> shift text right
< shift text left
y yank marked txt
d delete marked txt
- switch
v start visual mode
V start linewise visual mode
o move to other end of marked area
ctrl + v start visual block mode
O (visual mode) move to other corner of block
o (v mode) move to other end of marked area
L mv cursor to the bottom of the screen
w jump forwards to the start of a word
W jump forwards to the start of a words that can contains ponctuation
e jump forwards to the end of a word
E jump forwards to the end of a word that can contain ponctuation
b jumb backward to the start of a word
B jump backward to a ponctuated word
% move to matching character ( default supported pairs '()';'{}','[]' - use :h matchpairs in vim for more info)
0 jump 2 the start of the line
^ jump to the first non blank character
g_ jump to the last non blank character of the line
gg go to the first line of the doc
G go to the last line of the doc
5G go to line five
fx jump to the occurence of characer x
tx jump to before next occurence of the character x
( jump to the next §
) jump to the previous §
zz center cursor on the screen
Ctrl + b move back one on full screen
Ctrl + f move forward one full screen
Ctrl + d move forward 1/2 a screen
Ctrl + u move back 1/2 a screen
Nbr + movement cmd repeat the cmd nbr of time ex : 4j : moves 4 lines down
:e file edit in a new buffer
:bnext /:bn go to next buffer
:bp go to previous buffer
:bd delete a buffer/close a file
:ls list all open buffers
:sp file open a file in a new buffer and split window
:vsp file open a file in a new buffer and vertically split window
Ctrls + ws split window
Ctrl + ww switch windows
Ctrl + wq quit a window
Ctrl + wv split vertically
Ctrl + wh move cursor to the left window
Ctrl + wl move cursor to the right window (vertical split)
Ctrl + wj move to the window below (horizontal split)
Ctrl + wk move cursor to the window above (vertical split)
:tabnew open a file in a new tab (:tabnew file)
Ctrl + wT move the current split window into its own tab
gt or :tabnext / :tabn move to the next tab
gT or :tabprev / :tabp move to the previous tab
#gt mobe to the tab nbr #
:tabmove # move current tab to the #th position (indexed from 0)
:tabclose/tabc close the current tab and all its windows
:tabo/tabonly close all tabs except the current one
:tabdo cmd run the cmd command on all tabs (e.g. :tabdo q - close all the opened tabs)
n repeat search (patrn) in the same direction
N repeat search in the opposite direction
Show full summary Hide full summary

Similar

BASH
Fen Pin
Terminal Commands
Cameron James
Programming and Scripting Skills Needed
neteng33
Jeu Mystère
Fen Pin
Command-line editing
Nasir Nawaz
Common Shell Environment Variables
Nasir Nawaz
Manipulate Files
Fen Pin
Nombre Mystère
Fen Pin
Processing Text Using Filters (shell)
Ed de Jong
Langage C (WIP)
roussel.m
bilan de compétence RÉSEAU
Marie LAVARDA