VI 快速参考指南
2006-01-19 23:47
330 查看
快速参考指南
代码: | ||
*quickref* *Contents* tag subject tag subject ~ |Q_ct| 帮助文件清单 |Q_re| 重复命令 |Q_lr| 移动: 左右 |Q_km| 键盘映射 |Q_ud| 移动: 上下 |Q_ab| 缩写 |Q_tm| 移动: 文本目标 |Q_op| 选项 |Q_pa| 移动: 查找方式 |Q_ur| 取消/重复 命令 |Q_ma| 移动: 标记 |Q_et| 外部命令 |Q_vm| 移动: 其他 |Q_qf| Quickfix 命令 |Q_ta| 移动: 使用标签 |Q_vc| 其他命令 |Q_sc| 卷屏 |Q_ce| Ex: 命令行编辑 |Q_in| 插入: 插入文本 |Q_ra| Ex: 范围 |Q_ai| 插入: 普通键 |Q_ex| Ex: 特殊字符 |Q_ss| 插入: 特殊键 |Q_ed| 文件编辑 |Q_di| 插入: 二合字母 |Q_fl| 使用参数列表 |Q_si| 插入: 特殊插入 |Q_wq| 写入与退出 |Q_de| 改动: 删除文本 |Q_st| 启动 VIM |Q_cm| 改动: 拷贝与移动 |Q_ac| 自动命令 |Q_ch| 改动: 修改文本 |Q_wi| 多窗口命令 |Q_co| 改动: 复杂 |Q_bu| 缓冲列表命令 |Q_vi| 可视模式 |Q_sy| 语法加亮 |Q_to| 文本对象 |Q_gu| GUI 命令 |Q_fo| 折叠 ------------------------------------------------------------------------------ N 用来(可选)至于命令之前表示该命令执行的次数。 ------------------------------------------------------------------------------ *Q_lr* 左右移动 |h| N h 左 (亦: CTRL-H, <BS>, 或 <Left> 键) |l| N l 右 (亦: <Space> 或 <Right> 键) |0| 0 移动至本行第一个字符 (亦: <Home> 键) |^| ^ 移动至本行第一个非空白字符 |$| N $ 移动至本行(N-1 后续行)最后一个字符 (亦: <End> 键) |g0| N g0 移动至屏幕行的第一个字符 (当折行时和 "0" 不同) |g^| N g^ 移动至屏幕行的第一个非空白字符 (当折行时和 "^" 不同) |g$| N g$ 移动至屏幕行的最后一个字符 (当折行时和 "$" 不同) |gm| N gm 移动至屏幕行的中点 |bar| N | 移动至第N列 (缺省: 1) |f| N f{char} 移动至右边第 N 次出现{char}的地方 |F| N F{char} 移动至左边第 N 次出现{char}的地方 |t| N t{char} 移动至右边第 N 次出现{char}之前 |T| N T{char} 移动至左边第 N 次出现{char}之前 |;| N ; 重复上次 "f", "F", "t", 或 "T" 命令 N 次 |,| N , 以相反方向重复上次 "f", "F", "t", 或 "T" 命令 N 次 ------------------------------------------------------------------------------ *Q_ud* 上下移动 |k| N k 上移 N 行 (亦: CTRL-P 和 <Up>) |j| N j 下移 N 行 (亦: CTRL-J, CTRL-N, <NL>, 和 <Down>) |-| N - 上移 N 行, 并至第一个非空白字符 |+| N + 下移 N 行, 并至第一个非空白字符 (亦: CTRL-M 和 <CR>) |_| N _ 下移 N - 1 行, 并至第一个非空白字符 (亦: CTRL-M 和 <CR>) |G| N G 至第 N 行(缺省: 末行), 并至第一个非空白字符 |gg| N gg 至第 N 行(缺省: 首行), 并至第一个非空白字符 |N%| N % 至以行术计算文件的 % N 处. 必须给出 N, 否则是 |%| 命令. |gk| N gk 上移 N 行 (与 "k" 不同于折行的处理) |gj| N gj 下移 N 行 (与 "j" 不同于折行的处理) ------------------------------------------------------------------------------ *Q_tm* 文本对象移动 |w| N w 向前至第 N 个单词 |W| N W 向前 N 个空白隔开的单词 |WORD| |e| N e 向前至第 N 个单词词尾 |E| N E 向前至第 N 个以空白隔开的单词 |WORD| 的词尾 |b| N b 向后 N 个单词 |B| N B 向后至第 N 个以空白隔开的单词 |WORD| 的词尾 |ge| N ge 向后至第 N 个单词词尾 |gE| N gE 向后至第 N 个以空白隔开的单词 |WORD| 的词尾 |)| N ) 向前 N 个句子 |(| N ( 向后 N 个句子 |}| N } 向前 N 段 |{| N { 向后 N 段 |]]| N ]] 向前 N 节, 置于节的开始 |[[| N [[ 向后 N 节, 置于节的开始 |][| N ][ 向前 N 节, 置于节的末尾 |[]| N [] 向后 N 节, 置于节的末尾 |[(| N [( 向后至第 N 个未结束的 '(' |[{| N [{ 向后至第 N 个未结束的 '{' |[m| N [m 向后至第 N 个方法的开始 (用于 Java) |[M| N [M 向后至第 N 个方法的结束 (用于 Java) |])| N ]) 向前至第 N 个未结束的 ')' |]}| N ]} 向前至第 N 个未结束的 '}' |]m| N ]m 向前至第 N 个方法的开始 (用于 Java) |]M| N ]M 向前至第 N 个方法的结束 (用于 Java) |[#| N [# 向后至第 N 个未结束的 "#if" 或 "#else" |]#| N ]# 向前至第 N 个未结束的 "#else" or "#endif" |[star| N [* 向后至第 N 各注释的开始 "/*" |]star| N ]* 向前至第 N 各注释的结束 "*/" ------------------------------------------------------------------------------ *Q_pa* 按模式查找 |/| N /{pattern}[/[offset]]<CR> 向前查找第 N 次出现 {pattern}的地方 |?| N ?{pattern}[?[offset]]<CR> 向后查找第 N 次出现 {pattern}的地方 |/<CR>| N /<CR> 向前重复上次查找 |?<CR>| N ?<CR> 向后重复上次查找 |n| N n 重复上次查找 |N| N N 以反方向重复上次查找 |star| N * 向前查找光标下的标识符 |#| N # 向后查找光标下的标识符 |gstar| N g* 如 "*", 但也查找部分匹配 |g#| N g# 如 "*", 但也查找部分匹配 |gd| gd 移动至光标下表示符的局布声明 |gD| gD 移动至光标下表示符的全局声明 |pattern| 查找模式中的特殊字符 meaning magic nomagic ~ 匹配任意单个字符 . /. 匹配行首 ^ ^ 匹配 <EOL> $ $ 匹配单词开始 /< /< 匹配单词结束 /> /> 匹配标定范围中的单个字符 [a-z] /[a-z] 匹配不在标定范围中的单个字符 [^a-z] /[^a-z] 匹配一个标识符字符 /i /i 同上但不包括数字 /I /I 匹配一个关键字字符 /k /k 同上但不包括数字 /K /K 匹配一个文件名字符 /f /f 同上但不包括数字 /F /F 匹配一个可打印的字符 /p /p 同上但不包括数字 /P /P 匹配一个空白字符 /s /s 匹配一个非空白字符 /S /S 匹配 <Esc> /e /e 匹配 <Tab> /t /t 匹配 <CR> /r /r 匹配 <BS> /b /b 匹配 0 或多个前面的匹配原子 * /* 匹配 0 或多个前面的匹配原子 /+ /+ 匹配 0 或多个前面的匹配原子 /= /= 匹配 2 至 5 个前面的匹配原子 /{2,5} /{2,5} 隔开两种可能的匹配 /| /| 将一个模式组成一个匹配原子 /(/) /(/) |search-offset| 查找命令后可用的偏移量 [num] [num] 行向下, 位于第一栏 +[num] [num] 行向下, 位于第一栏 -[num] [num] 行向上, 位于第一栏 e[+num] 匹配结尾右方 [num] 个字符处 e[-num] 匹配结尾左方 [num] 个字符处 s[+num] 匹配启始右方 [num] 个字符处 s[-num] 匹配启始左方 [num] 个字符处 b[+num] 匹配启始右方 [num] 个字符处 b[-num] 匹配启始左方 [num] 个字符处 ;{search-command} 接着执行 {search-command} 查找 ------------------------------------------------------------------------------ *Q_ma* 标记与移动 |m| m{a-zA-Z} 用标记 {a-zA-Z} 记录当前位置 |`a| `{a-z} 移动至当前文件中的标记 {a-z} |`A| `{A-Z} 移动至任何文件中的标记 {A-Z} |`0| `{0-9} 移动至 Vim 上次退出的位置 |``| `` 移动至上次跳转至前的位置 |`quote| `" 移动至上次编辑此文件的位置 |`[| `[ 移动至上次被操作或放置的文本的开始 |`]| `] 移动至上次被操作或放置的文本的结尾 |`<| `< 移动至 (前次) 可视区域的开始 |`>| `> 移动至 (前次) 可视区域的结尾 |`.| `. 移动至当前文件最后被改动的位置 |'| '{a-zA-Z0-9[]'"<>.} 同 `, 但同时移动至该行的第一个非空白字符 |:marks| :marks 列出活动的标记 |CTRL-O| N CTRL-O 跳转至跳转列表中第 N 个较早的位置 |CTRL-I| N CTRL-I 跳转至跳转列表中第 N 个较晚的位置 |:ju| :ju[mps] 列出跳转列表 ------------------------------------------------------------------------------ *Q_vm* 其他移动 |%| % 找到本行中下一个括号,方括号,注释,或 "#if"/ "#else"/"#endif" 并移动至与其对称的位置 |H| N H 移动至窗口的第 N 行的第一个非空白字符处 |M| M 移动至窗口的中间行的第一个非空白字符处 |L| N L 移动至窗口的第 N 行(从下方算)的第一个非空白字符处 |go| N go 移动至缓冲的第 N 个字节 |:go| :[range]go[to] [off] 移动至缓冲的第 [off] 个字节 ------------------------------------------------------------------------------ *Q_ta* 使用标签 |:ta| :ta[g][!] {tag} 跳转至标签 {tag} |:ta| :[count]ta[g][!] Jump to [count]'th newer tag in tag list |CTRL-]| CTRL-] 跳转至光标下的标签,除非文件被改动 |:ts| :ts[elect][!] [tag] 列出匹配的标签并选择一个跳转 |:tjump| :tj[ump][!] [tag] 跳转至标签 [tag] ,当有多个匹配时从列表 中选择跳转 |:tags| :tags 列表标签 |CTRL-T| N CTRL-T 跳转至标签列表中第 n 个较早的标签 |:po| :[count]po[p][!] 跳转至标签列表中第 [count] 个较早的标签 |:tnext| :[count]tn[ext][!] 跳转至接下来的第 [count] 个匹配的标签 |:tp| :[count]tp[revious][!] 跳转至前面第 [count] 个匹配的标签 |:tr| :[count]tr[ewind][!] 跳转至第 [count] 各匹配的标签 |:tl| :tl[ast][!] 跳转至上次匹配的标签 |:ptag| :pt[ag] {tag} 打开一个显示 {tag} 标签的预览窗口 |CTRL-W_}| CTRL-W } 如 CTRL-] 但在预览窗口显示标签 |:pts| :pts[elect] 如 ":tselect" 但在预览窗口显示标签 |:ptjump| :ptj[ump] 如 ":tjump" 但在预览窗口显示标签 |:pclose| :pc[lose] 关闭标签预览窗口 |CTRL-W_z| CTRL-W z 关闭标签预览窗口 ------------------------------------------------------------------------------ *Q_sc* 滚屏 |CTRL-E| N CTRL-E 窗口下卷 N 行 (缺省: 1) |CTRL-D| N CTRL-D 窗口下卷 N 行 (缺省: 1/2 窗口) |CTRL-F| N CTRL-F 窗口前卷 N 页 (向下) |CTRL-Y| N CTRL-Y 窗口上卷 N 行 (缺省: 1) |CTRL-U| N CTRL-U 窗口上卷 N 行 (缺省: 1/2 窗口) |CTRL-B| N CTRL-B 窗口后卷 N 页 (向下) (向上) |z<CR>| z<CR> 或 zt 重画,当前行置窗口顶端 |z.| z. 或 zz 重画,当前行置窗口正中 |z-| z- 或 zb 重画,当前行置窗口底端 一下仅当 'wrap' 选项关闭时生效: |zh| N zh 屏幕右卷 N 个字符 |zl| N zl 屏幕左卷 N 个字符 |zH| N zH 屏幕右卷半个屏宽 |zL| N zL 屏幕左卷半个屏宽 ------------------------------------------------------------------------------ *Q_in* 插入文本 |a| N a 在光标后添加文本 (N 次) |A| N A 在行末添加文本 (N 次) |i| N i 在光标签插入文本 (N 次) (亦: <Insert>) |I| N I 在当前行的第一个非空白字符前插入文本 (N 次) |gI| N gI 在第一栏中插入文本 (N 次) |o| N o 在当前行下方开始新行,添加文本 (N 次) |O| N O 在当前行上方开始新行,添加文本 (N 次) |:startinsert| :star[tinsert][!] 开始插入模式,当使用 [!] 时添加文本 在可视块模式下: |v_b_I| I 在所有选中的行首插入同样的文本 |v_b_A| A 在所有选中的行尾添加同样的文本 ------------------------------------------------------------------------------ *Q_ai* 插入模式键 |insert-index| 插入模式命令的索引,以字母顺序排列 离开插入模式: |i_<Esc>| <Esc> 结束插入模式,回到普通模式 |i_CTRL-C| CTRL-C 同 <Esc>, 但不使用缩写 |i_CTRL-O| CTRL-O {command} 执行命令 {command} 并回到插入模式 移动: |i_<Up>| 光标键 左/右/上/下 移动光标 |i_<S-Left>| shift-left/right 左/右 移动一个单词 |i_<S-Up>| shift-up/down 向后/前一个屏幕 |i_<End>| <End> 光标至本行的末字符后 |i_<Home>| <Home> 光标至本行的首字符 ------------------------------------------------------------------------------ *Q_ss* 插入模式特别键 |i_CTRL-V| CTRL-V {char}.. 按表面意义插入字符, 或插入十进制数代表 的字节 |i_<NL>| <NL> 或 <CR> 或 CTRL-M 或 CTRL-J 开始新行 |i_CTRL-E| CTRL-E 插入光标下方的字符 |i_CTRL-Y| CTRL-Y 插入光标上方的字符 |i_CTRL-A| CTRL-A 插入上次插入的文本 |i_CTRL-@| CTRL-@ 插入上次插入的文本并结束 插入模式 |i_CTRL-R| CTRL-R {0-9a-z%#:.-="} 插入寄存器的内容 |i_CTRL-N| CTRL-N 插入光标位置前下一个匹配的标识符 |i_CTRL-P| CTRL-P 插入光标位置前上一个匹配的标识符 ???? |i_CTRL-X| CTRL-X ... 以各种方式完成光标前的单词 |i_<BS>| <BS> or CTRL-H 删除光标前的一个字符 |i_<Del>| <Del> 删除光标下的一个字符 |i_CTRL-W| CTRL-W 删除光标前的一个单词 |i_CTRL-U| CTRL-U 删除当前行的所有字符 |i_CTRL-T| CTRL-T 在当前行首插入一个以位宽度 |i_CTRL-D| CTRL-D 从当前行首删除一个以位宽度 |i_0_CTRL-D| 0 CTRL-D 删除当前行的所有缩进 |i_^_CTRL-D| ^ CTRL-D 删除当前行的所有缩进, 恢复下一行的缩进 ------------------------------------------------------------------------------ *Q_di* 二合字母 |:dig| :dig[raphs] 显示当前二合字母列表 |:dig| :dig[raphs] {char1}{char2} {number} ... 加入一个或多个二合字母到上述列表中 在插入或命令行方式下: |i_CTRL-K| CTRL-K {char1} {char2} 键入二合字母 |i_digraph| {char1} <BS> {char2} 若 'digraph' 选项被设置则键入二合字母 ------------------------------------------------------------------------------ *Q_si* 特殊插入 |:r| :r [file] 将文件 [file] 的内容插入到光标之下 |:r!| :r! {command} 将命令 {command} 的的标准输出插入到光标之下 ------------------------------------------------------------------------------ *Q_de* 删除文本 |x| N x 删除光标之下及之后的 N 个字符 |<Del>| N <Del> 删除光标之下及之后的 N 个字符 |X| N X 删除光标之前的 N 个字符 |d| N d{motion} 删除移动 {motion} 覆盖的文本 |v_d| {visual}d 删除加亮的文本 |dd| N dd 删除 N 行 |D| N D 删除至行尾 (以及下面 N-1 行) |J| N J 合并 N-1 行 (删除 <EOL>) |v_J| {visual}J 合并高亮的行 |gJ| N gJ 如 "J", 但不插入空格 |v_gJ| {visual}gJ 如 "{visual}J", 但不插入空格 |:d| :[range]d [x] 删除范围 [range] 覆盖的行 [存入寄存器 x] ------------------------------------------------------------------------------ *Q_cm* 拷贝和移动文本 |quote| "{char} 在接下来的删除, 剪切, 或放置命令中使用寄存器 {char} |:reg| :reg 显示所有寄存器的内容 |:reg| :reg {arg} 显示寄存器 {arg} 的内容 |y| N y{motion} 将动作 {motion} 覆盖的文本剪切至一个寄存器 |v_y| {visual}y 将加亮的文本剪切至一个寄存器 |yy| N yy 剪切 N 行至寄存器 |Y| N Y 剪切 N 行至寄存器 |p| N p 将一个寄存器的内容放置在光标位置后 (N times) |P| N P 将一个寄存器的内容放置在光标位置前 (N times) |]p| N ]p 如 p, 但调整当前行的缩进 |[p| N [p 如 P, 但调整当前行的缩进 |gp| N gp 如 p, 当将光标留在新文本之后 |gP| N gP 如 P, 当将光标留在新文本之后 ------------------------------------------------------------------------------ *Q_ch* 改变文本 |r| N r{char} 以 {char} 替换 N 个字符 |gr| N gr{char} 替换 N 个字符并不影响布局 |R| N R 进入替换模式 (重复键入的文本 N 次) |gR| N gR 进入虚替换模式: 如替换模式但 不影响布局 |v_b_r| {visual}r{char} 在可视块模式下: 以字符 {char} 替换被选中文本 的每个字符 (改变 = 删除文本并进入插入模式) |c| N c{motion} 改变动作 {motion} 覆盖的文本 |v_c| {visual}c 改变高亮的文本 |cc| N cc 改变 N 行 |S| N S 改变 N 行 |C| N C 改至行尾 (及 N-1 后续行) |s| N s 改变 N 个字符 |v_b_c| {visual}c 在可视块模式下: 用键入的文本改变选中文本 的每一行 |v_b_C| {visual}C 在可视块模式下: 用键入的文本改变选中各行 直至每行的行末 |~| N ~ 翻转 N 个字符的大小写并前进光标 |v_~| {visual}~ 翻转高亮文本的大小写 |v_u| {visual}u 该高亮的文本为小写 |v_U| {visual}U 该高亮的文本为大写 |g~| g~{motion} 将动作 {motion} 覆盖的文本翻转大小写 |gu| gu{motion} 将动作 {motion} 覆盖的文本置为小写 |gU| gU{motion} 将动作 {motion} 覆盖的文本置为大写 |v_g?| {visual}g? 对高亮的文本做 rot13 编码 |g?| g?{motion} 对动作 {motion} 覆盖的文本做 rot13 编码 |CTRL-A| N CTRL-A 将光标所在处或其后的数值增加 N |CTRL-X| N CTRL-X 将光标所在处或其后的数值减少 N |<| N <{motion} 将动作 {motion} 覆盖的所有行向左移动一个 移位宽度 |<<| N << 向左将 N 行移动一个移位宽度 |>| N >{motion} 将动作 {motion} 覆盖的所有行向左移动一个 移位宽度 |>>| N >> 向左将 N 行移动一个移位宽度 |gq| N gq{motion} 排列动作 {motion} 覆盖的所有行的格式, 将其 限于 'textwidth' 长度之内 |:ce| :[range]ce[nter] [width] 将范围 [range] 包括的行置中 |:le| :[range]le[ft] [indent] 左对齐范围 [range] 中的行 (使用 [indent]) |:ri| :[range]ri[ght] [width] 右对齐范围 [range] 中的行 ------------------------------------------------------------------------------
|
相关文章推荐
- VIM 快速参考指南
- MySQL新手入门指南--快速参考
- Visual Studio 2010快速参考指南里头的Scrum海报
- Jazz 系列: Jazz 平台快速参考指南(IBM)
- AngularJS快速入门指南20:快速参考
- MySQL新手入门指南--快速参考
- Visual Studio 2010快速参考指南里头的Scrum海报
- 支持/兼容 Linux 的嵌入式单板机快速参考指南
- AngularJS快速入门指南20:快速参考
- 英特尔多内核处理器:快速参考指南
- 注重实效的程序员之快速参考指南(1)
- 注重实效的程序员之快速参考指南
- 极速手游加速SDK快速指入指南+极速手游加速器SDK参考文档
- 注重实效的程序员之快速参考指南 The Elements of Programming Style
- 注重实效的程序员之快速参考指南
- VIM 快速参考指南
- iPhone6快速设计参考指南
- 《程序猿修炼之道--从小工到专家》注重实效的程序员之快速参考指南
- Eigen教程4 - 稀疏矩阵快速参考指南
- 注重实效的程序员之快速参考指南