GVIM Commands

🎨 gvim/vim Commands – Basic Operations

TopicQuestionAnswer
gvimOpen filegvim filename or vim filename
gvimOpen at linevim +10 filename
gvimOpen at patternvim +/pattern filename
gvimOpen multiple filesvim file1 file2 file3
gvimOpen in read-onlyvim -R filename or view filename
gvimOpen with diffvimdiff file1 file2
gvimExit without saving:q!
gvimSave file:w
gvimSave and exit:wq or :x or ZZ
gvimSave as:w newfilename
gvimSave part of file:10,20w partial.txt
gvimQuit all:qa
gvimSave all:wa
gvimEnter insert modei
gvimInsert after cursora
gvimInsert at line startI
gvimInsert at line endA
gvimOpen line belowo
gvimOpen line aboveO
gvimExit insert modeESC or CTRL + [ or CTRL + c
gvimEnter command mode:
gvimDelete characterx
gvimDelete character beforeX
gvimDelete linedd
gvimDelete N linesNdd (e.g., 5dd)
gvimDelete to end of lineD or d$
gvimDelete to start of lined0 or d^
gvimDelete worddw
gvimDelete word backwarddb
gvimDelete inside worddiw
gvimDelete around worddaw
gvimDelete inside quotesdi" or di'
gvimDelete around quotesda" or da'
gvimDelete inside parenthesesdi( or dib
gvimDelete around parenthesesda( or dab
gvimDelete inside bracketsdi[ or di{
gvimDelete around bracketsda[ or da{
gvimDelete to characterdf{char} or dt{char}
gvimChange wordcw
gvimChange inside wordciw
gvimChange linecc or S
gvimChange to endC
gvimCopy (yank) lineyy or Y
gvimCopy N linesNyy (e.g., 3yy)
gvimCopy wordyw
gvimCopy to end of liney$
gvimCopy to start of liney0
gvimCopy inside wordyiw
gvimCopy entire file:%y or ggVGy
gvimPaste after cursorp
gvimPaste before cursorP
gvimPaste from register"ap
gvimUndou
gvimUndo lineU
gvimRedoCTRL + r
gvimRepeat last command.
gvimRepeat last :command@:

🧭 gvim/vim Commands – Navigation

TopicQuestionAnswer
gvimMove lefth
gvimMove downj
gvimMove upk
gvimMove rightl
gvimMove to line start0
gvimMove to first non-blank^
gvimMove to line end$
gvimMove to file startgg or 1G
gvimMove to file endG
gvimGo to line N:N or NG
gvimMove forward wordw
gvimMove forward WORDW
gvimMove backward wordb
gvimMove backward WORDB
gvimMove to end of worde
gvimMove to end of WORDE
gvimMove forward sentence)
gvimMove backward sentence(
gvimMove forward paragraph}
gvimMove backward paragraph{
gvimMove forward to charf{char}
gvimMove backward to charF{char}
gvimMove till chart{char}
gvimMove till char backwardT{char}
gvimRepeat last f/t;
gvimReverse last f/t,
gvimJump to matching bracket%
gvimScroll down half pageCTRL + d
gvimScroll up half pageCTRL + u
gvimScroll down full pageCTRL + f
gvimScroll up full pageCTRL + b
gvimScroll line downCTRL + e
gvimScroll line upCTRL + y
gvimCenter screen on cursorzz
gvimTop of screenzt
gvimBottom of screenzb
gvimMove to top of screenH
gvimMove to middle of screenM
gvimMove to bottom of screenL

🔎 gvim/vim Commands – Search & Replace

TopicQuestionAnswer
gvimSearch forward/{pattern}
gvimSearch backward?{pattern}
gvimNext search resultn
gvimPrevious search resultN
gvimSearch word under cursor*
gvimSearch word backward#
gvimSearch case insensitive/pattern\c
gvimSearch case sensitive/pattern\C
gvimClear search highlight:noh or :nohlsearch
gvimFind and replace in line:s/old/new/
gvimFind and replace all in line:s/old/new/g
gvimFind and replace in file:%s/old/new/g
gvimReplace with confirmation:%s/old/new/gc
gvimReplace in range:10,20s/old/new/g
gvimReplace in visual selection:'<,'>s/old/new/g
gvimReplace with case insensitive:%s/old/new/gi
gvimReplace whole word:%s/\<old\>/new/g
gvimGlobal command:g/pattern/command
gvimDelete lines matching:g/pattern/d
gvimCopy lines matching:g/pattern/y A

🎯 gvim/vim Commands – Visual Mode

TopicQuestionAnswer
gvimEnter visual modev
gvimEnter visual line modeV
gvimEnter visual block modeCTRL + v
gvimSelect allggVG
gvimReselect last selectiongv
gvimSelect inner wordviw
gvimSelect around wordvaw
gvimSelect inner sentencevis
gvimSelect inner paragraphvip
gvimSelect inner blockvi{ or vib
gvimIndent selection>
gvimUnindent selection<
gvimToggle case~
gvimMake uppercaseU
gvimMake lowercaseu
gvimSort selection:sort
gvimIncrement numbersCTRL + a
gvimDecrement numbersCTRL + x

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top