First, move the cursor
1、移动到行尾"$",移动到行首"0"(数字),移动到行首第一个字符处"^"2、移动到段首"{",移动到段尾"}"3、移动到下一个词"w",移动到上一个词"b"4、移动到文档开始"gg",移动到文档结束"G"5、跳到第n行"ngg" 或 "nG" 或 ":n"6、移动光标到屏幕顶端"H",移动到屏幕中间"M",移动到底部"L"7、移动到上次编辑文件的位置 "`"
Second, edit the operation
1. Insert after cursor"A", end of line insertion"A" 2, after inserting A line insert"O", insert a row in front of the plug"O" 3, delete character insertion"S", delete the positive row insert"S" 4, insert before cursor"I", inserted at the beginning of the line"I" 5, delete one row"DD", after deleting into insert mode"CC" or"S" 6, delete a word"DW", delete a word into insert mode"CW" 7, delete one character"X" or"DL", delete a character into the insert mode "s" or "CL" 8, Paste "P", exchange two characters "XP" 9, swap two lines "DDP" 10, copy "Y", copy a line "yy" 11, copy the Forward "yy" or "Y" 12, Undo "U", Redo "Ctrl + R" 13, delete to the end of the line can use "D" or "C" 14, delete the current character "X" 15,">>" Indent all selected code 16, "<<" to indent all selected code 17, merge two lines "J" 18, Reopen ": e!" If you do not want to save the file 19. If you want to open the new file ": E filename", then use "Ctrl + ^" for file switching
Third, the simple configuration of vim
To the user directory, create a new file for. VIMRC, and then write the following configuration in it
syntax enable //语法高亮 set number //显示行号set cursorline //突出显示当前行set ruler //打开状态栏标尺set shiftwidth=4 //设定 << 和 >> 命令移动时的宽度为 4set softtabstop=4 //使得按退格键时可以一次删掉 4 个空格set tabstop=4 //设定 tab 长度为 4
Yigol
Link: https://www.jianshu.com/p/6f13474d36ac
Source: Jane book
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
&NBSP;
Summary of VIM edit shortcut keys under Mac