Global

  • :h[elp] keyword - ရှာလိုသော keyword အတွက် help ဖွင့်သည်
  • :sav[eas] file - ဖိုင်အသစ် save သည်
  • :clo[se] - လက်ရှိ window ကိုပိတ်သည်
  • :ter[minal] - terminal window ဖွင့်သည်
  • K - cursor ထောက်ထားသော စာလုံးသည် vim command ဖြစ်ခဲ့သော် ထိုစာလုံးနှင့်သက်ဆိုင်သော help file ကိုဖွင့်သည်
Tip Run vimtutor in a terminal to learn the first Vim commands.

Cursor ရွှေ့ခြင်း

  • h - ဘယ်ဘက်သို့ cursor တစ်ချက်ရွှေ့သည်
  • j - အောက်သို့ cursor တစ်ချက်ရွှေ့သည်
  • k - အပေါ်သို့ cursor တစ်ချက်ရွှေ့သည်
  • l - ညာဘက်သို့ cursor တစ်ချက်ရွှေ့သည်
  • gj - move cursor down (multi-line text)
  • gk - move cursor up (multi-line text)
  • H - screen ၏ထိပ်ဆုံးသို့ ရွှေ့သည်
  • M - screen ၏အလယ်သို့ ရွှေ့သည်
  • L - screen ၏အောက်ဆုံးသို့ ရွှေ့သည်
  • w - နောက်စာလုံးတစ်လုံး၏ ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည် (punctuation များကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • W - နောက်စာလုံးတစ်လုံး၏ ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည် (စာလုံး + punctuations ကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • e - နောက်စာလုံးတစ်လုံး၏ နောက်ဆုံးအက္ခရာသို့ ရွှေ့သည် (punctuation များကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • E - နောက်စာလုံးတစ်လုံး၏ နောက်ဆုံးအက္ခရာသို့ ရွှေ့သည် (စာလုံး + punctuations ကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • b - ရှေ့စာလုံးတစ်လုံး၏ ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည် (punctuation များကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • B - ရှေ့စာလုံးတစ်လုံး၏ ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည် (စာလုံး + punctuations ကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • ge - ရှေ့စာလုံးတစ်လုံး၏ နောက်ဆုံးအက္ခရာသို့ ရွှေ့သည် (punctuation များကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • gE - ရှေ့စာလုံးတစ်လုံး၏ နောက်ဆုံးအက္ခရာသို့ ရွှေ့သည် (စာလုံး + punctuations ကို စာလုံးတစ်လုံးအနေနှင့် ထည့်တွက်သည်)
  • % - သက်ဆိုင်ရာ character သို့ cursor ရွှေ့သည် (default supported pairs: '()', '{}', '[]' - use :h matchpairs in vim for more info)
  • 0 - စာကြောင်းတစ်ကြောင်း၏ အရှေ့ဆုံး သို့ရွှေ့သည်
  • ^ - စာကြောင်းတစ်ကြောင်း၏ ပထမဆုံး non-blank character သို့ရွှေ့သည်
  • $ - စာကြောင်းတစ်ကြောင်း၏ အနောက်ဆုံး သို့ရွှေ့သည်
  • g_ - စာကြောင်းတစ်ကြောင်း၏ နောက်ဆုံး non-blank character သို့ရွှေ့သည်
  • gg - document တစ်ခု၏ ထိပ်ဆုံးစာကြောင်း သို့ရွှေ့သည်
  • G - document တစ်ခု၏ နောက်ဆုံးစာကြောင်း သို့ရွှေ့သည်
  • 5gg or 5G - line နံပါတ် ၅ သို့ရွှေ့သည်(၅ အစား ကြိုက်ရာဂဏန်း အသုံးပြုနိုင်သည်)
  • gd - move to local declaration
  • gD - move to global declaration
  • fx - cursor ၏အနောက်ပိုင်းတွင် character x ကိုရှာပြီး x မရောက်ခင် ရှေ့အက္ခရာသို့ cursor ရွှေ့သည် (x အစား ရှာလိုရာစကားလုံး ထည့်နိုင်သည်)
  • tx - cursor ၏အနောက်ပိုင်းတွင် character x ကိုရှာပြီး x ၏နောက်အက္ခရာသို့ cursor ရွှေ့သည် (x အစား ရှာလိုရာစကားလုံး ထည့်နိုင်သည်)
  • Fx - cursor ၏အရှေ့ပိုင်းတွင် character x ကိုရှာပြီး x မရောက်ခင် ရှေ့အက္ခရာသို့ cursor ရွှေ့သည် (x အစား ရှာလိုရာစကားလုံး ထည့်နိုင်သည်)
  • Tx - cursor ၏အရှေ့ပိုင်းတွင် character x ကိုရှာပြီး x ၏နောက်အက္ခရာသို့ cursor ရွှေ့သည် (x အစား ရှာလိုရာစကားလုံး ထည့်နိုင်သည်)
  • ; - f, t, F or T movement ကိုပြန်သုံးသည်
  • , - f, t, F or T movement ကိုပြန်သုံးသည် (backwards)
  • } - နောက် paragraph သို့ cursor ကိုရွှေ့သည် (or function/block, when editing code)
  • { - ရှေ့ paragraph သို့ cursor ကိုရွှေ့သည် (or function/block, when editing code)
  • zz - cursor ကို screen ၏အလယ်သို့ ရွှေ့သည်
  • zt - position cursor on top of the screen
  • zb - position cursor on bottom of the screen
  • Ctrl + e - cursor မရွှေ့ဘဲ screen ကိုအောက်တစ်ကြောင်း ဆင်းသည်
  • Ctrl + y - cursor မရွှေ့ဘဲ screen ကိုအပေါ်တစ်ကြောင်း တက်သည်
  • Ctrl + b - screen တစ်ခုစာ အပေါ်တက်သည်
  • Ctrl + f - screen တစ်ခုစာ အောက်ဆင်းသည်
  • Ctrl + d - screen တစ်ဝက်စာ အောက်ဆင်းသည်
  • Ctrl + u - screen တစ်ဝက်စာ အပေါ်တက်သည်
Tip Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.

Insert mode - စာရိုက်ခြင်း

  • i - cursor ၏ ရှေ့တစ်နေရာတွင် insert mode ပြောင်းသည်
  • I - လက်ရှိစာကြောင်း၏ ရှေ့ဆုံးတွင် insert mode ပြောင်းသည်
  • a - cursor ၏နောက်အက္ခရာတွင် insert mode ပြောင်းသည်
  • A - လက်ရှိစာကြောင်း၏ နောက်ဆုံးတွင် insert mode ပြောင်းသည်
  • o - လက်ရှိစာကြောင်း၏ အောက်တစ်ကြောင်းသို့ ဆင်း၍ insert mode ပြောင်းသည်
  • O - လက်ရှိစာကြောင်း၏ အပေါ်တစ်ကြောင်းသို့ တက်၍ insert mode ပြောင်းသည်
  • ea - စကားလုံးတစ်လုံး၏‌ နောက်အက္ခရာတွင် insert mode ပြောင်းသည်
  • Ctrl + h - insert mode ပြောင်းထားချိန်တွင် cursor ၏ ရှေ့အက္ခရာတစ်လုံးကို ဖျက်သည်
  • Ctrl + w - insert mode ပြောင်းထားချိန်တွင် cursor ၏ ရှေ့စာလုံးတစ်လုံးကို ဖျက်သည်
  • Ctrl + j - insert mode ပြောင်းထားချိန်တွင် စာကြောင်းအသစ်ယူသည်
  • Ctrl + t - insert mode ပြောင်းထားချိန်တွင် ညာဘက်သို့ Tab တစ်ခု ခုန်သည်
  • Ctrl + d - insert mode ပြောင်းထားချိန်တွင် ဘယ်ဘက်သို့ Tab တစ်ခု ဆုတ်သည်
  • 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 - register x မှ contents များကိုထည့်သည်
  • 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 - reflow paragraph
  • g~ - switch case up to motion
  • gu - Lowercase ပြောင်းသည်
  • gU - Uppercase ပြောင်းသည်
  • cc - စာကြောင်းတစ်ကြောင်းလုံး ဖျက်၍ အသစ်ပြင်သည်
  • c$ or C - စာကြောင်း၏ နောက်ဆုံးနေရာတွင် ပြင်သည်(C နှင့် လုပ်ဆောင်ပုံ တူညီသည်)
  • ciw - စကားလုံး တစ်လုံးစာပြင်သည်
  • cw or ce - စကားလုံး၏ နောက်ဆုံးအက္ခရာ ၏အနောက်တွင် insert mode ပြောင်းသည်
  • s - စကားလုံးတစ်လုံးစာ ဖျက်၍ အသစ်အစားထိုးသည်
  • S - တစ်ကြောင်းလုံး ဖျက်၍ အသစ်ပြင်သည်(cc နှင့် လုပ်ဆောင်ပုံ တူညီသည်)
  • xp - အက္ခရာ နှစ်ခုကို ရှေ့နောက်ပြောင်းသည်
  • u - undo
  • U - restore (undo) last changed line
  • Ctrl + r - redo
  • . - နောက်ဆုံးလုပ်ဆောင်ခဲ့သော command ကိုပြန်လည်လုပ်ဆောင်သည်

စာလုံးများကို select မှတ်ခြင်း (visual mode)

  • v - visual mode သို့ပြောင်းသည်
  • V - visual mode သို့ပြောင်းပြီး cursor ရှိရာ စာကြောင်းတစ်ကြောင်းလုံး select မှတ်သည်
  • o - cursor အား select မှတ်ထားသော စာပိုဒ်၏ ထိပ်ဆုံး (သို့) နောက်ဆုံး သို့ရွှေ့သည်
  • Ctrl + v - visualသို့ရွှေ့သည်ပြောင်းသည်
  • O - move to other corner of block
  • aw - စာလုံးတစ်လုံးစာ select မှတ်သည်
  • ab - () တစ်ခုလုံးကို select မှတ်သည်
  • aB - {} တစ်ခုလုံးကို select မှတ်သည်
  • at - <> တစ်ခုလုံးကို select မှတ်သည်
  • ib - () အတွင်းရှိစာများကို select မှတ်သည်
  • iB - {} အတွင်းရှိစာများကို select မှတ်သည်
  • it - <> အတွင်းရှိစာများကို select မှတ်သည်
  • Esc or Ctrl + c - visual mode မှထွက်သည်
Tip Instead of b or B one can also use ( or { respectively.

Visual commands

  • > - visual mode တွင် မှတ်ထားသော စာများကို ညာဘက်သို့ ရွှေ့သည်
  • < - visual mode တွင် မှတ်ထားသော စာများကို ဘယ်ဘက်သို့ ရွှေ့သည်
  • y - visual mode တွင် မှတ်ထားသော စာများကို copy လုပ်သည်
  • d - visual mode တွင် မှတ်ထားသော စာများကို ဖျက်သည်
  • ~ - switch case
  • u - မှတ်ထားသော စာများကို lowercase ပြောင်းသည်
  • U - မှတ်ထားသော စာများကို uppercase ပြောင်းသည်

Registers

  • :reg[isters] - registers content များကိုပြသည်
  • "xy - register x ထဲသို့ yank (copy) လုပ်သည်
  • "xp - register x မှ contents များကို paste သည်
  • "+y - system clipboard register ထဲသို့ yank (copy) လုပ်သည်
  • "+p - system clipboard register မှ contents များကို paste သည်
Tip Registers are being stored in ~/.viminfo, and will be loaded again on next restart of 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 and positions

  • :marks - list of marks
  • ma - အမှတ် A ၏ တည်နေရာကို သတ်မှတ်သည်
  • `a - cursor ကို အမှတ် A ရှိရာသို့ရွှေ့သည်
  • y`a - လက်ရှိ cursor ရှိရာနေရာမှ အမှတ် A ရှိရာနေရာထိ yank(copy) လုပ်သည်
  • `0 - go to the position where Vim was previously exited
  • `" - လက်ရှိဖိုင်၏ နောက်ဆုံးပြင်ခဲ့သော နေရာသို့ cursor အား ရွှေ့သည်
  • `. - 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.

Macros

  • qa - macro a ကို record စလုပ်သည်
  • q - record ရပ်သည်
  • @a - macro a ကို run သည်
  • @@ - နောက်ဆုံး run ခဲ့သော macro ကိုပြန် run သည်

Cut and paste

  • yy - စာကြောင်းတစ်ကြောင်းစာ yank (copy) သည်
  • 2yy - စာကြောင်းနှစ်ကြောင်းစာ yank (copy) သည်
  • yw - cursor ရှိရာ စကားလုံးမှစ၍ စာလုံး၏ နောက်ဆုံး အက္ခရာအထိ yank (copy) လုပ်သည်
  • yiw - cursor ရှိရာ စကားလုံးတစ်ခုလုံးကို yank (copy) လုပ်သည်
  • yaw - cursor ရှိရာ စကားလုံးတစ်ခုလုံးကို yank (copy) လုပ်၍ cursor ကို ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည်
  • y$ or Y - cursor ရှိရာ စကားလုံးမှစ၍ စာကြောင်း၏ နောက်ဆုံး အက္ခရာအထိ yank (copy) လုပ်သည်
  • p - cursor ထောက်ထားသောအက္ခရာ၏ နောက်တစ်နေရာတွင် put (paste) လုပ်သည်
  • P - cursor ထောက်ထားသောအက္ခရာ၏ ရှေ့တစ်နေရာတွင် put (paste) လုပ်သည်
  • 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 - စာကြောင်းတစ်ကြောင်းကို delete (cut) သည်
  • 2dd - စာကြောင်းနှစ်ကြောင်းကို delete (cut) သည်
  • dw - cursor ရှိရာ စကားလုံးမှစ၍ နောက်စာလုံး၏ ရှေ့ဆုံးအက္ခရာအထိ delete (cut) သည်
  • diw - cursor ရှိရာ စကားလုံးတစ်ခုလုံးကို delete (cut) လုပ်သည်
  • daw - cursor ရှိရာ စကားလုံးတစ်ခုလုံးကို delete (cut) လုပ်၍ cursor ကို ထိပ်ဆုံးအက္ခရာသို့ ရွှေ့သည်
  • :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 - cursor ရှိရာ စကားလုံးမှစ၍ စာကြောင်း၏ နောက်ဆုံး အက္ခရာအထိ delete (cut) လုပ်သည်
  • x - အက္ခရာ တစ်လုံးစာ delete (cut) လုပ်သည်

Indent text

  • >> - စာကြောင်းကို ညာဘက်သို့ shiftwidth တစ်ခုစာ ရွှေ့သည်
  • << - စာကြောင်းကို ဘယ်ဘက်သို့ shiftwidth တစ်ခုစာ ရွှေ့သည်
  • >% - cursor ထောက်ထားသော () (သို့) {} block တစ်ခုလုံးစာကို ညာဘက်သို့ shiftwidth တစ်ခုစာ ရွှေ့သည်
  • <% - de-indent a block with () or {} (cursor on brace)
  • >ib - cursor ထောက်ထားသော () အတွင်းရှိစာများကို ညာဘက်သို့ shiftwidth တစ်ခုစာ ရွှေ့သည်
  • >at - cursor ထောက်ထားသော <> block တစ်ခုလုံးစာကို ညာဘက်သို့ shiftwidth တစ်ခုစာ ရွှေ့သည်
  • 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

VIM မှထွက်ခြင်း

  • :w - လက်ရှိဖိုင် ကို write (save) သည် (VIM မှမထွက်ပါ)
  • :w !sudo tee % - လက်ရှိဖိုင် ကို sudo (with admin privileges) ဖြင့် write (save) သည်
  • :wq or :x or ZZ - လက်ရှိဖိုင် ကို write (save) ပြီး VIM မှထွက်သည်
  • :q - VIM မှထွက်သည် (save မလုပ်လျှင် ထွက်၍မရပါ)
  • :q! or ZQ - save မလုပ်ဘဲ VIM မှထွက်သည်
  • :wqa - save လုပ်ပြီး tabs အကုန်ပိတ်သည်

Search and replace

  • /pattern - ဖိုင်ထဲတွင် pattern ကိုရှာသည် (forward)
  • ?pattern - ဖိုင်ထဲတွင် pattern ကိုရှာသည် (backward)
  • \vpattern - 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
  • n - ရှေ့ဘက်သို့ဆက်၍ တူညီသော ရှာဖွေမှုကို ထပ်မံပြုလုပ်သည်
  • N - နောက်သို့ပြန်၍ တူညီသော ရှာဖွေမှုကို ထပ်မံပြုလုပ်သည်
  • :%s/old/new/g - ဖိုင်တစ်ခုလုံးတွင် ရှာလိုသောစကားလုံးအားလုံး ကိုရှာ၍ စကားလုံးအသစ်ဖြင့် အစားထိုးသည်( 'old' နေရာတွင် ရှာလိုသော စကားလုံးထည့်၍ 'new' နေရာတွင်အစားထိုးလိုသောစကားလုံးကိုထည့်ရမည်)
  • :%s/old/new/gc - ဖိုင်တစ်ခုလုံးတွင် ရှာလိုသောစကားလုံးအားလုံး ကိုရှာ၍ စကားလုံးအသစ်ဖြင့် အစားထိုးသည်( အစားမထိုးခင် ရှာတွေ့ထားသောစာလုံးတစ်လုံးချင်းစီကို အစားထိုးမည် မထိုးမည် ကို confirm အရင်လုပ်သည်)
  • :noh[lsearch] - ရှာတွေ့ထားသော စကားလုံးများကို highlight ပြန်ဖျောက်သည်

Search in multiple files

  • :vim[grep] /pattern/ {`{file}`} - ရှာလိုသော pattern ကို ဖိုင်များတွင် ရှာသည်
e.g. :vim[grep] /foo/ **/*
  • :cn[ext] - jump to the next match
  • :cp[revious] - jump to the previous match
  • :cope[n] - ရှာတွေ့ထားသမျှ list ကို windows အသစ်ဖြင့်ကြည့်သည်
  • :ccl[ose] - quickfix window ပြန်ပိတ်သည်

Tabs

  • :tabnew or :tabnew {page.words.file} - Tab အသစ်ယူ၍ ဖိုင်ဖွင့်သည်
  • Ctrl + wT - move the current split window into its own tab
  • gt or :tabn[ext] - ညာဘက် tab သို့သွားသည်
  • gT or :tabp[revious] - ဘယ်ဘက် tab သို့သွားသည်
  • #gt - Tab number # သို့သွားသည်
  • :tabm[ove] # - လက်ရှိ tab ကို #th position သိုရွှေ့သည် (tab number သည် သုညမှ စသည်)
  • :tabc[lose] - လက်ရှိ tab ကိုပိတ်သည်
  • :tabo[nly] - လက်ရှိ tab မှလွဲ၍ ကျန် tab အားလုံးကိုပိတ်သည်
  • :tabdo command - run the command on all tabs (e.g. :tabdo q - closes all opened tabs)

Working with multiple files

  • :e[dit] file - edit a file in a new buffer
  • :bn[ext] - go to the next buffer
  • :bp[revious] - go to the previous buffer
  • :bd[elete] - delete a buffer (close a file)
  • :b[uffer]# - go to a buffer by index #
  • :b[uffer] file - go to a buffer by file
  • :ls or :buffers - list all open buffers
  • :sp[lit] file - open a file in a new buffer and split window
  • :vs[plit] file - open a file in a new buffer and vertically split window
  • :vert[ical] ba[ll] - edit all buffers as vertical windows
  • :tab ba[ll] - edit all buffers as tabs
  • Ctrl + ws - split window
  • Ctrl + wv - split window vertically
  • Ctrl + ww - switch windows
  • Ctrl + wq - quit a window
  • Ctrl + wx - exchange current window with next one
  • Ctrl + w= - make all windows equal height & width
  • Ctrl + wh - move cursor to the left window (vertical split)
  • Ctrl + wl - move cursor to the right window (vertical split)
  • Ctrl + wj - move cursor to the window below (horizontal split)
  • Ctrl + wk - move cursor to the window above (horizontal split)
  • 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.