Home > Linux > Main text

Syntax of Vim editor


Tag: linux, vi


一些常用操作的快捷键

ctrl+A ## move cursor to the start of a line
ctrl+E ## move cursor to the end of a line
Esc+B  ## move to beginning of previous or current word
ctrl+K ## delete from current cursor to the end 
ctrl+U ## delete from beginning to the current cursor
ctrl+W ## delete the word before the cursor
Alt+B  ## goes back one word at a time
Alt+F  ## move forward one word at a time
Alt+C  ## capitalizes letter where cursor is and moves to the end of word

Comment multiple lines as discussed here

  1. press Esc (to leave editing or other mode)
  2. hit ctrl + v (visual block mode)
  3. use the up/down arrow keys to select lines
  4. Shift + i (capital I):这时光标会在所选择的block的第一行的第一个字符处
  5. insert the text you want, i.e. #
  6. press Esc Esc,一定是两次Esc.

Uncomment multiple lines

  1. press Esc (to leave editing or other mode)
  2. hit ctrl + v (visual block mode)
  3. use the up/down arrow keys to select lines
  4. Shift + x (capital X)


If you link this blog, please refer to this page, thanks!
Post link:https://tsinghua-gongjing.github.io/posts/vi.html

Previous: Common test to measure significance