You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[number]<command><object>or<command>[number]<object>
hjkl (leftup down right)
esc or ctrl + [ -normalmode
:<press_tab>- autocomplete some commands
:<start_command> then press ctrl-d- see all commands
:q!-quit from file without save
:wq-quit from file with save
:w- save changes
:w<file_name>- save changestofile with name
:!<external_command>-execute external command
:e<file_name>-editfiles
:source<file_path>-readvimscript
esc - enter tonormalmodeu-undo operation
U -undoall operations inline
ctrl-r-toundo the previousundocommand
COMMANDS:i,a,o,r,c,x,d,p
OBJECTS:w,e,b,$,^
MOVE commands
w-movetostart of word (2w, 3w, #w)
e-movetoend of word (2e, 3e, 3#)
b-move back tostart of word (2b, 3b, #b)
B -move back tostart of WORD
0-move caret tostart of line
^ -move caret tostart of line$-move cart toend of line
gg -movetostart of file
G -movetoend of file
#G -movetoline # where # number of line%-move caret tonext )]}
{ -gotopreviousemptyline
} -gotonextemptyline
Enter INSERT mode
i- here
I -instart of linea- after current
A -inend of lineo-move caret tonextline
O -move caret topreviousliner- can just edit current symbol
R - enter in REPLACE mode
DELETE then enter INSERT mode
cw-delete word
ce-delete from caret toend of word
c$-delete from caret toend of linec^ -delete from caret tostart of line
DELETE commands
x-deleteright symbol andmove caret left
dw - from caret toend of word WITH space (can use d#w)
de - from caret toend of word WITHOUT space
d$- from caret toend of lined^ - from caret tostart of linedi' - delete text in ''
di" - delete text in ""
dd -deleteline (can use #dd)
dt<character>-delete from caret to<character>
COPY and PASTE commands
:r<command or file_name>-copy text from output of command of filep-paste text from bufferpw- from caret toend of word WITH space (can use d#w)
pe- from caret toend of word WITHOUT space
p$- from caret toend of linep^ - from caret tostart of liney-copy selected text tobuffer
yw - from caret toend of word WITH space (can use d#w)
ye - from caret toend of word WITHOUT space
y$- from caret toend of liney^ - from caret tostart of line
Y -copylinetobuffer
FILE info
ctrl-g-file status
FIND in FILE
*-find current word infile
/<text>-find text infile
?<text>-find text iffile backward
:noh-nohighlight- use it after complete searchn-gotonextN-gotoprevious
ctrl-o-gotostart of search (can use several time)
ctrl-i-goto ahead
f<search_character>-findinlinef<search_character> then ; -findinline then next
F<search_character>-findinline backward
F<search_character> then ; -findinline backward then nextt<search_character>-findinlineandset caret before <search_character>
T<search_character>-findinlineandset caret after <search_character>
FIND and REPLACE
:s/<find_text>/<replace_text>-tofirst occurrence
:s/<find_text>/<replace_text>-inline
:#,#s/<find_text>/<replace_text>/g- where # -number of lines
:%s/<find_text>/<replace_text>/g-inallfile
:%s/<find_text>/<replace_text>/gc -inallfile with confirmation
VISUAL mode
v- enter tovisualmode
In visualmode you can:
1) Select some text and save it tonewfile:
v- enter tovisualmode
: -commandmodew<file_name>- save selected text tofile with name
2) Delete some text:
v- enter tovisualmoded-delete selected text
Internal help
:help
CTRL-W CTRL-W -move between windows
You can use :helpcommand with arguments:
:helpw
:help c_CTRL-D
:helpinsert-index
:helpuser-manual
SET commands
:set<command>
In some cases if you type `no` before command it disable it
:setnumber-enable numbers of line
:setexpandtab-enable dots instead of tabs
:settabstop=2-settabsor dot width equal 2
:sethlsearch-highlightsearch
:setincsearch- incremental search (search begin immediately)
:setic-ignorecase
:setnoic-noignorecase
:sethlsis- means 'hlsearch incsearch'
:nohlsearch- disable highlights
Work with windows
ctrl+w+n-opennewwindow horizontaly
ctrl+w+hjkl -movecursortowindow
ctrl+w+HJKL -movewindowto side
ctrl+w+q-quitall windows