Dowemo

Vim is an enhanced version of vi

Vim has three modes:

  • Command mode ( general mode )
    When vim starts, the default enter command mode. Any mode can be returned by pressing esc to return to command mode ( multiple clicks. Command mode can complete selection, copy, paste, undo, and so on by typing different commands.
    Command mode in command mode:

i 在光标处插入内容


o 在当前行下面插入行


dd 删除整行


yy 当前行放入缓冲区(复制当前行)


n+yy 将当前n行放入缓冲区


p 将缓冲区内容的文本放入光标后(粘贴)


u 撤销上一个操作


r 替换当前字符


/查找关键字 "n"键在查找到的字符中切换






  • Insert mode
    Press"I"in command mode to enter insert mode. In insert mode, you can enter text editing content and use the esc key to return the command mode.

  • Ex mode
    In command mode, press: "key can enter ex mode, the cursor moves to the bottom, where you can save the modification or exit vim.
    Command functionality in ex mode:


:w 保存当前修改


:q 退出(不保存)


:q! 强制退出(不保存)


:x 保存并退出 = :wq


:set number 显示行号(set nu)


:! 系统命令 执行一个系统命令并显示结果


:sh 切换到命令行 Ctrl+d 切换回vim









Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs