User Tools

Site Tools


linux:vim-editor

Vim Editor

Cursor movement commands

  h     move the cursor one space to the left
  j     move the cursor one space down
  k     move the cursor one space up
  l     move the cursor one space to the right

Deleting text

  x     delete the character at the cursor
  dd    delete a line    

File saving

  :w    save (write to disk)
  :q    exit
  :q!   quit and not save

Modifing Text

  a           Append some text from the current cursor postion
  A           Append at the end of the line
  i           Insert text to the Left of the cursor
  I           Inserts text to the Left of the first non-white character
                  on current line
  o           Open a new line and adds text Below current line
  O           Open a new line and adds text Above the current line

undo the chages

On occasions you may need to undo the changes. The following commands restore the text after changes.

  u           Undo the last command
  U           Undo the current line from all changes on that line
  :e!         Edit again. Restores to the state of the last save

Other commands

Go to line on Vim: First enter the number of line and press "shift + G"
linux/vim-editor.txt · Last modified: 2022/10/29 16:15 by 127.0.0.1