Essential Vim Commands Every Linux User Should Know

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.พ. 2025
  • VIM Editor commands:
    :wq - save and exit
    Shift + G - bottom of the file
    gg - to go to top of the line
    /QA - forward search + press N to go next occurrence
    ?QA - backward search + press n for next occurrence
    Replace:
    :%s/QA/TEST/g - replace all QA to TEST
    Undo and redo:
    In Command mode press u - for undo
    Ctrl +r - for REDO
    insert
    Press o - for next line +insert mode
    Shift + o - for previous line +insert mode
    I - insert mode at the start of the line
    Shift + a - insert mode at the end of the line
    Press x - to delete a charcter
    Paste
    P - paste in next line
    Shift + p - paste in prev line
    Copy and paste:
    Shift + v ( for selecting the entire line )
    Press v - to bring in visual mode and now you can use right arrow to select the lines ( THIS selects all the visual lines )
    Now press y ( for copy )
    Press p ( paste )
    For display line number in file
    :set nu
    For removing line number in file
    :set nonu
    For turn off/on the color lines for script file
    :syntax off
    :syntax on
    To go as line number:
    :100 ( cursor go to 100th line )

ความคิดเห็น •