VIM Commands

Vim Commands

Commands in NORMAL modes

Motions

small granular: move by direction

k
h l
j

mid granular: move by word

  • e move onto the end of the current word
  • b move onto the head of the current word
  • w move onto the head of the next word

large granular: move by line

  • $ move onto the head char of the line
  • 0 move onto the tail char of the line

huge granular: move by paragraph

  • { move onto the last blank line
  • ( move onto the begnning of this paragraph
  • } & ) move onto the next blank line

extreme granular: move by file

  • [line number]G move to the specific line
  • gg move to the first line of the file
  • G move to the last line of the file

Operators

Operators make effects on the corpus when assigned to some range (defined by cursor movement or the object). Operator could be doubled to work on the current line
{Operator} + {Motions} OR {Object} = Operation

  • d delete
  • daw aw for a word(defined by space)
  • dap ap for a whole paragraph(defined by blank line)
  • y yank into register
  • c change
  • g~ swap case
  • gu make lowercase
  • gU Make uppercase
  • > shift right
  • < shift right
  • = auto indent
  • ! filter {Motion} lines through an external program

Undo Tasks

  • u undo one certain operation
    (one editing command in normal mode, all editing in insert mode last time)
  • Ctrl-r for redo one task

Special Command g

Begin Editing

into INSERT mode

  • i begin inserting at current position
  • a begin inserting at the next position
  • A begin inserting at the end of the line
  • o begin inserting at the beginning of the new line below
  • O begin inserting at the beginning of the new line above
  • s delete the current char & begin inserting
  • S delete the current line & begin inserting at the head of current line
  • C delete the rest of current line & begin editing

local modification

  • r character replacement (quit insert mode after one char modification)
  • D delete the rest of the line
  • J combine this line and the next

Copy and Paste

  1. 删除的文本将储存在寄存器中
  2. p 将寄存器的内容放在光标下方的行

f{char} find the next occurence of {char}
; repeat the last search operation

Command in INSERT modes

Delete in insert mode

  • Ctrl-h Backspace
  • Ctrl-w delect back one word
  • Ctrl-u delect back to start of line
posted @ 2017-11-28 08:25  JHaoWon  阅读(133)  评论(0编辑  收藏  举报