පොදු

  • :h[elp] විධානය - විධානය සඳහා උපකාරය විවෘත කරන්න
  • :sav[eas] ගොනුව - ගොනුව ලෙස සුරකින්න
  • :clo[se] - වත්මන් කවුළුව වසන්න
  • :ter[minal] - open a terminal window
  • K - කර්සරය යට ඇති වදනට අදාල උපකාරය විවෘත කරන්න
Tip Run vimtutor in a terminal to learn the first Vim commands.

කර්සරය එහා මෙහා ගෙනයාම සහ පැනීම

  • h - කර්සරය වමට ගෙනයන්න
  • j - කර්සරය පහලට ගෙනයන්න
  • k - කර්සරය ඉහළට ගෙනයන්න
  • l - කර්සරය දකුණට ගෙනයන්න
  • gj - move cursor down (multi-line text)
  • gk - move cursor up (multi-line text)
  • H - තිරයේ ඉහළට යන්න
  • M - තිරයේ මැදට යන්න
  • L - තිරයේ පහළට යන්න
  • w - වදනක ආරම්භයක් පාසා ඉදිරියට යන්න
  • W - වදනක ආරම්භයක් පාසා ඉදිරියට යන්න (වදන් වලට විරාම ලකුණු තිබිය හැක)
  • e - වදනක අවසානයක් පාසා ඉදිරියට යෑමට
  • E - වදනක අවසානයක් පාසා ඉදිරියට යෑමට (වදන් වලට විරාම ලකුණු තිබිය හැක)
  • b - වදනක ආරම්භයක් පාසා ආපසු හැරීම
  • B - වදනක ආරම්භයක් පාසා ආපසු හැරීම (වදන් වලට විරාම ලකුණු තිබිය හැක)
  • ge - jump backwards to the end of a word
  • gE - jump backwards to the end of a word (words can contain punctuation)
  • % - ගැළපුම් අනුලකුණ වෙත මාරු කරන්න (පෙරනිමි ආධාරක යුවල: '()', '{}', '[]' - භාවිතා කරන්න) වැඩි විස්තර සඳහා :h_matchpairs
  • 0 - පේළියේ ආරම්භයට පනින්න
  • ^ - පේළියේ පළමු හිස් නොවන අනුලකුණ වෙත පනින්න
  • $ - පේළියේ අවසානය දක්වා පැනීම
  • g_ - පේළියේ අන්තිම හිස් නොවන අනුලකුණ වෙත පනින්න
  • gg - ලේඛනයේ පළමු පේළිය වෙත පනින්න
  • G - ලේඛනයේ අවසන් පේළිය වෙත පනින්න
  • 5gg or 5G - පස් වැනි පේළිය වෙත පනින්න
  • gd - move to local declaration
  • gD - move to global declaration
  • fx - x අනුලකුණේ ඊලඟ අවස්ථාව වෙත පැනීම
  • tx - x අනුලකුණේ ඊලඟ අවස්ථාවට පෙර පනින්න
  • Fx - x අනුලකුණේ පෙර අවස්ථාවට පනින්න
  • Tx - x අනුලකුණේ පෙර අවස්ථා අනුපිළිවෙලට පනින්න
  • ; - පෙර f, t, F හෝ T විධාන නැවත වරක් කරන්න
  • , - පෙර f, t, F හෝ T විධාන නැවත වරක් භාවිතා කරන්න
  • } - ඊළඟ ඡේදයට යන්න (හෝ ක්රියාත්මක කිරීම / බ්ලොක්, කේත සංස්කරණය කරන විට)
  • { - පෙර ඡේදයට පෙරාතුව (හෝ ක්රියාත්මක කිරීම / අවහිර කිරීම, කේත සංස්කරණය කිරීමේදී)
  • zz - කර්සරය තිරය මත කේන්ද්රීය පිහිටුවීම
  • zt - position cursor on top of the screen
  • zb - position cursor on bottom of the screen
  • Ctrl + e - ලේඛනයේ එක් පේළියක තිරය ඉහළට ගෙනයාම (කර්සරය එලෙසම)
  • Ctrl + y - ලේඛනයේ එක් පේළියක තිරය පහළට ගෙනයාම (කර්සරය එලෙසම)
  • Ctrl + b - එක් පූර්ණ තිරයක් ආපසු යන්න
  • Ctrl + f - එක් පූර්ණ තිරයක් ඉදිරියට ගෙනයයි
  • Ctrl + d - තිරයෙන් භාගයක් පහළට යන්න
  • Ctrl + u - තිරයෙන් භාගයක් ඉහළට යන්න
Tip කර්සරය චලනය නැවත කිරීමට, අංකයක් සමඟ එය පෙරසන්න. උදාහරණයක් ලෙස: 4j කර්සරය පේළි 4 ක් පහළට ගෙන එයි.

ඇතුළත් කරන්න - පෙළ ඇතුළත් කරන්න

  • i - කර්සරයට පෙර ඇතුල් කරන්න
  • I - පේළිය ආරම්භයේදී ඇතුල් කරන්න
  • a - කර්සරයට පසු ඇතුල් කරන්න (එකතු කරන්න)
  • A - පේළිය අවසානයේ ඇතුල් කරන්න (එකතු කරන්න)
  • o - nawa පේළිය (විවෘත කරන්න) වර්තමාන පේළිය පහළින් නව පේළිය
  • O - වර්තමාන පේළිය ඉහලින් නව පේළිය (විවෘත කරන්න)
  • ea - වදන අවසානයේ එක් කරන්න
  • Ctrl + h - delete the character before the cursor during insert mode
  • Ctrl + w - delete word before the cursor during insert mode
  • Ctrl + j - begin new line during insert mode
  • Ctrl + t - indent (move right) line one shiftwidth during insert mode
  • Ctrl + d - de-indent (move left) line one shiftwidth during insert mode
  • Ctrl + n - insert (auto-complete) next match before the cursor during insert mode
  • Ctrl + p - insert (auto-complete) previous match before the cursor during insert mode
  • Ctrl + rx - insert the contents of register x
  • Ctrl + ox - Temporarily enter normal mode to issue one normal-mode command x.
  • Esc or Ctrl + c - ඇතුල් කිරීමේ ප්‍රකාරයෙන් (Insert Mode) පිටවන්න

සංස්කරණය කිරීම

  • r - කර්සරය ට යටින් ඇති අනුලකුණ වෙන එකක් මගින් ප්‍රතිස්ථාපනය
  • R - replace more than one character, until ESC is pressed.
  • J - පහළ පේළිය වත්මන් එකට සම්බන්ධ කරන්න
  • gJ - පහළ පේළිය වත්මන් එකට සම්බන්ධ කරන්න (හිස්තැනක් නොමැතිව)
  • gwip - ඡේදය පුනරුච්චාරණය කරන්න
  • g~ - switch case up to motion
  • gu - change to lowercase up to motion
  • gU - change to uppercase up to motion
  • cc - සම්පූර්ණ පේළිය මුල සිටම වෙනස් කරන්න
  • c$ or C - පේළිය අවසානය වෙනස් කරන්න (ප්‍රතිස්ථාපනය කරන්න)
  • ciw - සම්පූර්ණ වදන වෙනස් කරන්න
  • cw or ce - වදන අවසානය දක්වා වෙනස් කරන්න (ප්‍රතිස්ථාපනය කරන්න)
  • s - අනුලකුණක් මකා දමන්න (ප්‍රතිස්ථාපනය කරන්න).
  • S - සම්පූර්ණ පේළිය ආරම්භයේ සිට වෙනස් කරන්න (cc)
  • xp - අනුලකුණ දෙකක් හුවමාරුව (මකා ආපසු ඇලවීම)
  • u - අවලංගු කරන්න
  • U - restore (undo) last changed line
  • Ctrl + r - අවසානට අවලංගු කරන ලද විධානය (u) නැවතත් කරන්න (r)
  • . - අවසාන විධානය නැවත වරක් ක්රියාත්මක කරන්න

පේළි ලකුණු කිරීම (දෘශ්‍ය ප්‍රකාරය – Visual Mode)

  • v - දෘශ්‍ය ප්‍රකාරය ආරම්භ කරන්න, පේළි ලකුණු කරන්න, විධානය ක්රියාත්මක කරන්න (y පිටපත් කරන්න)
  • V - දෘශ්‍ය ප්‍රකාරයෙන් පේළි ආරම්භ කරන්න
  • o - ලකුණෙහි අනෙක් කෙළවරට පනින්න
  • Ctrl + v - බ්ලොක් සඳහා දෘශ්‍ය ප්‍රකාරය ආරම්භ කරන්න
  • O - බ්ලොක් එකේ අනෙක් කෙළවරට පනින්න
  • aw - වදන ලකුණු කරන්න
  • ab - බ්ලොක් ()
  • aB - බ්ලොක් {}
  • at - a block with <> tags
  • ib - ඇතුළත බ්ලොක් ()
  • iB - ඇතුළත බ්ලොක් {}
  • it - inner block with <> tags
  • Esc or Ctrl + c - දෘශ්‍ය ප්‍රකාරයෙන් පිටවීම
Tip Instead of b or B one can also use ( or { respectively.

දෘශ්‍ය ප්‍රකාරයේ විධාන (Visual Mode Commands)

  • > - පෙළ දකුණට ගෙන යන්න
  • < - පෙළ වමට ගෙන යන්න
  • y - තෝරාගත් පෙළ පිටපත් කරන්න
  • d - තෝරාගත් පෙළ මකන්න
  • ~ - මහකුරු / කුඩා අකුරු හුවමාරුව
  • u - change marked text to lowercase
  • U - change marked text to uppercase

රෙජිස්ටර්

  • :reg[isters] - රෙජිස්ටර් අන්තර්ගතය පෙන්වන්න
  • "xy - රෙජිස්ටරයට පිටපත් කරන්න
  • "xp - රෙජිස්ටර් අන්තර්ගතය ආදේශ කරන්න
  • "+y - yank into the system clipboard register
  • "+p - paste from the system clipboard register
Tip ටයිප් රෙජිස්ටර් ~/.viminfo තුල ගබඩා කර ඇත, නැවතත් නැවතත් Vim සමග අලුතෙන් ආරම්භ වේ.
Tip Special registers:

0 - last yank
" - unnamed register, last delete or yank
% - current file name
# - alternate file name
* - clipboard contents (X11 primary)
+ - clipboard contents (X11 clipboard)
/ - last search pattern
: - last command-line
. - last inserted text
- - last small (less than a line) delete
= - expression register
_ - black hole register

සලකුණු කිරීම

  • :marks - සලකුණු ලැයිස්තුව
  • ma - මෙම ස්ථානය a යනුවෙන් සලකුණු කරන්න
  • `a - a සලකුණු වෙත යන්න
  • y`a - a සලකුණ යෙදු ස්ථානයට පිටපත් කරන්න
  • `0 - go to the position where Vim was previously exited
  • `" - go to the position when last editing this file
  • `. - go to the position of the last change in this file
  • `` - go to the position before the last jump
  • :ju[mps] - list of jumps
  • Ctrl + i - go to newer position in jump list
  • Ctrl + o - go to older position in jump list
  • :changes - list of changes
  • g, - go to newer position in change list
  • g; - go to older position in change list
  • Ctrl + ] - jump to the tag under cursor
Tip To jump to a mark you can either use a backtick (`) or an apostrophe ('). Using an apostrophe jumps to the beginning (first non-blank) of the line holding the mark.

මැක්රෝස්

  • qa - a මැක්රෝව පටිගත කිරීම ආරම්භය
  • q - මැක්රෝව පටිගත කිරීම නතර කරන්න
  • @a - මැක්රෝව a නැවත ධාවනය ආරම්භය
  • @@ - අවසන් මැක්රෝව යලි ධාවනය

පිටපත් කිරීම, කැපීම සහ ඇලවීම

  • yy - පිටපත් කරන්න
  • 2yy - පේළි 2 ක් පිටපත් කරන්න
  • yw - කර්සරය යටින් ඇති වදන පිටපත් කරන්න.
  • yiw - වදන පිටපත් කරන්න
  • yaw - කර්සරය යට වදන පෙර හෝ පසුව පිටපත් කරන්න
  • y$ or Y - පේළියේ අවසානය දක්වා පිටපත් කරන්න
  • p - කර්සරයට පසු ඇමිණුම් පිටපත් කරගත් පේළි අලවන්න
  • P - කර්සරයට පසු ඇමිණුම් පිටපත් කරගත් පේළි අලවන්න
  • gp - put (paste) the clipboard after cursor and leave cursor after the new text
  • gP - put (paste) before cursor and leave cursor after the new text
  • dd - වත්මන් පේළිය මකන්න (කපන්න)
  • 2dd - පේළි 2 ක් (වත්මන් හා පහත) මකන්න (කැපීම)
  • dw - ඊළඟ වදන ය දක්වා කර්සරය යට අක්ෂර මකා දැමීම (කැපීම)
  • diw - වදන මකන්න (කැපීම)
  • daw - කර්සරය යටින් ඇති වදන ය සහ මකා දැමීම පෙර හෝ පසුව (අවහිර කිරීම්) අවකාශය
  • :3,5d - delete lines starting from 3 to 5
Tip You can also use the following characters to specify the range:
e.g.

:.,$d - From the current line to the end of the file
:.,1d - From the current line to the beginning of the file
:10,$d - From the 10th line to the beginning of the file

  • :g/{pattern}/d - delete all lines containing pattern
  • :g!/{pattern}/d - delete all lines not containing pattern
  • d$ or D - පේළි අවසානය දක්වා මකන්න (කැපීම)
  • x - අක්ෂර ඉවත් කරන්න (කැපීම)

Indent text

  • >> - indent (move right) line one shiftwidth
  • << - de-indent (move left) line one shiftwidth
  • >% - indent a block with () or {} (cursor on brace)
  • <% - de-indent a block with () or {} (cursor on brace)
  • >ib - indent inner block with ()
  • >at - indent a block with <> tags
  • 3== - re-indent 3 lines
  • =% - re-indent a block with () or {} (cursor on brace)
  • =iB - re-indent inner block with {}
  • gg=G - re-indent entire buffer
  • ]p - paste and adjust indent to current line

සුරකින්න සහ පිටවීම

  • :w - ගොනුව ලියන්න, නමුත් වසා නොගන්න
  • :w !sudo tee % - වර්තමාන ගොනුව sudo සමග ලියන්න
  • :wq or :x or ZZ - ගොනුව ලියන්න සහ වසන්න
  • :q - ගොනුවේ වසන්න ( සුරකිය යුතු යුතු වෙනස්කම් ඇතිනම් මෙම විධානය අනතුරු අඟවයි)
  • :q! or ZQ - ගොනුවේ වසන්න සහ වෙනස්කිරීම් ඉවත් කරන්න
  • :wqa - සියලු ටැබ් සුරකින්න සහ වසා දමන්න

සෙවීම සහ ප්‍රතිස්ථාපනය

  • /pattern - රටාව (ඉදිරියට) සොයන්න
  • ?pattern - රටාව (පසුපසට) සොයන්න
  • \vpattern - අකුරු නොවන අනුලකුණු සහිත රටා : අකුරු නොවන අකුරු අකුරු සංකේත ලෙස අර්ථ දැක්විය හැකිය (විශේෂ කිරීමක් නොමැති සෙවීමකට)
  • n - නැවත සෙවීම (එකම දිශාව)
  • N - නැවත සෙවීම (ප්‍රතිවිරුද්ධ දිශාව)
  • :%s/old/new/g - සම්පූර්ණ ලේඛනයේ යෙදෙන අවස්ථා ප්‍රතිස්ථාපනය කරන්න
  • :%s/old/new/gc - සම්පූර්ණ ලේඛනයේ යෙදෙන අවස්ථා ප්‍රතිස්ථාපනය කරන්න, ස්ථිර කිරීම
  • :noh[lsearch] - සෙවුම් ප්‍රතිපල වලින් සියලු ලකුණු ඉවත් කරන්න

ගොනු කිහිපයක් තුල සෙවීම

  • :vim[grep] /pattern/ {`{file}`} - ගොනු කිහිපයක් තුල සෙවීම
e.g. :vim[grep] /foo/ **/*
  • :cn[ext] - රටාවේ ඊළඟ යෙදුමට (ඉදිරියට) යන්න
  • :cp[revious] - රටාවේ ඊළඟ යෙදුමට (පසුපසට) යන්න
  • :cope[n] - රටාවේ සියලු යෙදීම් ලැයිස්තුව සහිත කවුළුව විවෘත කරන්න
  • :ccl[ose] - close the quickfix window

ටැබ්

  • :tabnew or :tabnew {page.words.file} - නව ටැබයක ලිපිගොනුව විවෘත කරන්න
  • Ctrl + wT - වත්මන් කැඩී කවුළුව ටැබ් එකට ගෙනයාම
  • gt or :tabn[ext] - ඊළඟ ටැබයට මාරු වන්න
  • gT or :tabp[revious] - පෙර ටැබයට මාරුවීම
  • #gt - # වන ටැබයට මාරුවීම
  • :tabm[ove] # - වත්මන් ටැබ් # වන ස්ථානයට (දර්ශකය 0 සිට)
  • :tabc[lose] - වත්මන් ටැබය සහ එහි සියළු කවුළු වසා දමන්න
  • :tabo[nly] - වත්මන් ටැබය හැර සියලු ටැබ් වසා දමන්න
  • :tabdo command - සියලු ටැබ් මත විධානය ක්‍රියාත්මක කරන්න (උ.දා. :tabdo q - විවෘත කළ සියලු ටැබ් වසා දමයි)

ගොනු කිහිපයක් සමඟ වැඩ කිරීම

  • :e[dit] ගොනුව - නව බෆරයක ගොනුවක් සංස්කරණය කරන්න
  • :bn[ext] - ඊළඟ බෆරය වෙත යන්න
  • :bp[revious] - පෙර බෆරය වෙත යන්න
  • :bd[elete] - බෆරයක් මකන්න (ගොනුව වසා දමන්න)
  • :b[uffer]# - go to a buffer by #
  • :b[uffer] file - go to a buffer by file
  • :ls or :buffers - සියලු විවෘත බෆර් ලැයිස්තුගත කරන්න
  • :sp[lit] ගොනුව - නව බෆර් සහ ද්විත්ව කවුළුවක ගොනුව විවෘත කරන්න
  • :vs[plit] ගොනුව - නව බෆරයක ගොනුවක් විවෘත කර සිරස් වින්යාස සහිත කවුළුවක විවෘත කරන්න
  • :vert[ical] ba[ll] - edit all buffers as vertical windows
  • :tab ba[ll] - edit all buffers as tabs
  • Ctrl + ws - කවුළුව භේදනය (තිරස් භේදය)
  • Ctrl + wv - කවුළුව භේදනය (සිරස් භේදය)
  • Ctrl + ww - ඊළඟ කවුළුව වෙත යන්න
  • Ctrl + wq - කවුළුව වසන්න
  • Ctrl + wx - exchange current window with next one
  • Ctrl + w= - make all windows equal height & width
  • Ctrl + wh - වම් කවුළුව වෙත කර්සරය ගෙනයාම (සිරස් භේදය)
  • Ctrl + wl - දකුණු කවුළුව වෙත කර්සරය ගෙනයාම (සිරස් භේදය)
  • Ctrl + wj - පහත දැක්වෙන කවුළුව කර්සරය ගෙනයාම (තිරස් භේදය)
  • Ctrl + wk - ඉහළ කවුළුව වෙත ගෙන යාම (තිරස් භේදය)
  • Ctrl + wH - make current window full height at far left (leftmost vertical window)
  • Ctrl + wL - make current window full height at far right (rightmost vertical window)
  • Ctrl + wJ - make current window full width at the very bottom (bottommost horizontal window)
  • Ctrl + wK - make current window full width at the very top (topmost horizontal window)

Diff

  • zf - manually define a fold up to motion
  • zd - delete fold under the cursor
  • za - toggle fold under the cursor
  • zo - open fold under the cursor
  • zc - close fold under the cursor
  • zr - reduce (open) all folds by one level
  • zm - fold more (close) all folds by one level
  • zi - toggle folding functionality
  • ]c - jump to start of next change
  • [c - jump to start of previous change
  • do or :diffg[et] - obtain (get) difference (from other buffer)
  • dp or :diffpu[t] - put difference (to other buffer)
  • :diffthis - make current window part of diff
  • :dif[fupdate] - update differences
  • :diffo[ff] - switch off diff mode for current window
Tip The commands for folding (e.g. za) operate on one level. To operate on all levels, use uppercase letters (e.g. zA).
Tip To view the differences of files, one can directly start Vim in diff mode by running vimdiff in a terminal. One can even set this as git difftool.