你应该知道的vim插件之surround.vim
2012-10-21 16:14
239 查看
写代码的时候你会发现这个插件是多么有用!
强烈推荐!
0×01.change
0×02.adding
比如,我要把这个小标题外围用strong标签包括起来,再也不用像以后那样
敲了,只需要:
甚至在编辑模式时也可以添加surroundings,这时是通过 ctrl+s 映射来支持的。
千万要注意:
在很多终端里面,这个快捷键会终止输出然后你的会话将被冻结!
如果这样的杯具发生了的话,不要慌,只须按ctrl+q 来解冻。
如果你想从你的终端里移除ctrl+s映射的话,把 stty stop 添加到你的shell启动配置
文件(如bash的.bashrc ,ksh的.kshrc 等 )。
一些插入模式时的例子:
0×03.delete
全部命令和快捷键参考:
下载地址:
surround.vim – Delete/change/add parentheses/quotes/XML-tags/much more with ease : vim online
更多信息,详见:
本文参考资料:
Vim Plugins You Should Know About, Part I: surround.vim – good coders code, great reuse
转载自:http://ihacklog.com/post/vim-plugins-you-should-know-about-surround.html
强烈推荐!
0×01.change
1 2 3 4 5 6 | cs"' cs"<q> cs)] cst<p> csw' csW' |
1 2 3 4 5 6 7 8 9 10 11 | 文本 命令 结果 --------------- ------- ----------- "Hello |world!" cs"' 'Hello world!' "Hello |world!" cs"<q> <q>Hello world!</q> (123+4|56)/2 cs)] [123+456]/2 (123+4|56)/2 cs)[ [ 123+456 ]/2 <div>foo|</div> cst<p> <p>foo</p> fo|o! csw' 'foo'! fo|o! csW' 'foo!' (| 为光标位置) |
比如,我要把这个小标题外围用strong标签包括起来,再也不用像以后那样
敲了,只需要:
1 | yss<strong> |
1 2 3 4 5 6 7 8 9 10 | Text Command New Text --------------- ------- ----------- Hello w|orld! ysiw) Hello (world)! Hello w|orld! csw) Hello (world)! fo|o ysiwt<html> <html>foo</html> foo quu|x baz yss" "foo quux baz" foo quu|x baz ySS" " foo quux baz " (| is the position of cursor in these examples) |
千万要注意:
在很多终端里面,这个快捷键会终止输出然后你的会话将被冻结!
如果这样的杯具发生了的话,不要慌,只须按ctrl+q 来解冻。
如果你想从你的终端里移除ctrl+s映射的话,把 stty stop 添加到你的shell启动配置
文件(如bash的.bashrc ,ksh的.kshrc 等 )。
一些插入模式时的例子:
1 2 3 4 5 6 7 8 | Command New Text ------- ------------ <CTRL-s>" "" <CTRL-s><CTRL-s><html> <html> | </html> (| is the position of cursor in these examples) |
1 | ds |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Normal mode ----------- ds - delete a surrounding cs - change a surrounding ys - add a surrounding yS - add a surrounding and place the surrounded text on a new line + indent it yss - add a surrounding to the whole line ySs - add a surrounding to the whole line, place it on a new line + indent it ySS - same as ySs Visual mode ----------- s - in visual mode, add a surrounding S - in visual mode, add a surrounding but place text on new line + indent it Insert mode ----------- <CTRL-s> - in insert mode, add a surrounding <CTRL-s><CTRL-s> - in insert mode, add a new line + surrounding + indent <CTRL-g>s - same as <CTRL-s> <CTRL-g>S - same as <CTRL-s><CTRL-s> |
surround.vim – Delete/change/add parentheses/quotes/XML-tags/much more with ease : vim online
更多信息,详见:
1 | :h surround |
Vim Plugins You Should Know About, Part I: surround.vim – good coders code, great reuse
转载自:http://ihacklog.com/post/vim-plugins-you-should-know-about-surround.html
相关文章推荐
- 你应该知道的vim插件之surround.vim
- 程序员应该知道的100个Vim命令
- 开发人员应该知道的15个吸引力的jquery lightbox插件推荐
- 程序员应该知道的100个vim命令
- 每个程序员都应该知道的 100 个 vim 命令
- vim 插件之 surround.vim
- 程序员应该知道的100个vim命令
- 【转】程序员应该知道的100个vim命令
- 喂,前端,你应该知道的chrome插件
- 每个程序员都应该知道的 100 个 vim 命令
- 程序员应该知道的100个vim命令 分享
- Ubuntu系统安装、升级和安装插件应该知道的几件事
- 程序员应该知道的100个vim命令
- 程序员应该知道的100个vim命令以及Vim 键盘图
- 每个开发者都应该知道的20个实用jQuery插件
- 每一个Blogger都应该知道的16个Firefox SEO 插件
- 每个开发者都应该知道的20个实用jQuery插件
- 意外之喜-VIM插件之vim-surround
- 推荐几个你应该知道的Studio插件
- vim中的杀手级插件: surround