你应该知道的vim插件之surround.vim
写代码的时候你会发现这个插件是多么有用!
强烈推荐!
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> cs cs <div>foo|</div> cst<p> <p>foo</p> fo|o! csw' 'foo'! fo|o! csW' 'foo!' (| 为光标位置) |
0×02.adding
比如,我要把这个小标题外围用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) |
甚至在编辑模式时也可以添加surroundings,这时是通过 ctrl+s 映射来支持的。
千万要注意:
在很多终端里面,这个快捷键会终止输出然后你的会话将被冻结!
如果这样的杯具发生了的话,不要慌,只须按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) |
0×03.delete
|
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 Insert mode |
下载地址:
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
你应该知道的vim插件之surround.vim的更多相关文章
- vim 插件之 surround.vim
surround.vim-这个插件主要是用来插入一些特殊符号的(成对出现) 下载地址 http://www.vim.org/scripts/script.php?script_id=1697 http ...
- vim 插件之 gist.vim 的安装
用 IntelliJ 的时觉得 create gist 很好用,查了下,发现 vim 下也有这个插件,于是马上配置上. 安装 下载 Gist.vim 解压后进入目录,拷贝文件 cp plugin/gi ...
- 喂,前端,你应该知道的chrome插件
最近,优点闲. 压力,有点大,回顾,曾今被问,你怎么查看内存泄露,然后,一脸蒙. 工欲善其事, 必先利其器 最近在研究chrome devtools,发现,其实他很强.而且chrome6周一次的更新, ...
- 在Mac上使用vundle自动安装vim插件,并用vim代替sourceinsight
一直以来在Mac上找不到好的代码阅读工具,最近根据网上的教程,自己总结一下,做了个在Mac的类sourceinsight的vim,感觉很好用.我不喜欢那种把vim搞的很复杂的配置,所以做了个仅仅能满足 ...
- vim插件之delimitMate.vim
delimitMate.vim--这个插件主要是在插入模式下,用来自动补全括号.引号等 下载地址 http://www.vim.org/scripts/script.php?script_id=275 ...
- 【原创】vim插件安装简介
一.安装vundle(vim插件管理软件): git clone https://github.com/VundleVim/Vundle.vim 拷贝目录到 ~/.vim/bundle/Vundle. ...
- vim插件安装总结
vim插件安装总结 vim 插件 vundle 插件对于vim来说是一个杀手级别的神器助手,能自动补全,语法高亮,文件搜索等等,有效地提升了编程效率.下面就个人的一些安装和使用进行一个总结. 自动管理 ...
- 好用的vim插件
# 好用的vim插件 ### 简介------------------------------ 记录vim好用的插件 ### vimcdoc vim中文帮助文档-------------------- ...
- Sublime编辑器上的Linux Vim插件常用快捷键
Sublime编辑器上的 Vim 插件常用快捷键 vim 的设置: 在Reference-> User Settings(首选项--> 设置用户) 选项,点击进入配置文件编辑状态,默认的用 ...
随机推荐
- C++中类所占的存储空间
#include <iostream> using namespace std; class A { int m_a; int get() { return m_a; } virtual ...
- Mybatis批量更新<转>
Mybatis批量更新 批量操作就不进行赘述了.减少服务器与数据库之间的交互.网上有很多关于批量插入还有批量删除的帖子.但是批量更新却没有详细的解决方案. 实现目标 这里主要讲的是1张table中.根 ...
- QT在CT上的安装及运行
http://www.cubie.cc/forum.php?mod=viewthread&tid=2662&highlight=qt
- 华为/中兴 3G 语音的调试
1 microcom -s 9600 /dev/ttyUSB2(/dev/ttyUSB2不能错) 2 AT(看是否有OK输出) 3 AT+CREG?(0,1代表GSM网络注册成功) 4 AT+CSQ? ...
- 多媒体开发之rtp 打包发流--- 从h264中获取分辨率
http://blog.csdn.net/DiegoTJ/article/details/5541877 http://www.cnblogs.com/lidabo/p/4482684.html 分辨 ...
- 让div也出现滑动框。
<div id="box" style="height: 300px; width: 200px; border:1px solid #CCC; overflow: ...
- bundle安装方法
sudo chmod +x filename.bundle sudo ./filename .bundle 原文链接:http://www.chinastor.com/a/linux/ubuntu/0 ...
- Ubuntu下Eclipse无法添加Tomcat7解决方法
Ubuntu(Linux)下在eclipse中add一个tomcatserver时发现tomcat7无法选择,但是该tomcat已经在eclipse 的server->runtime envir ...
- 修改Android 界面颜色
btnGetCode.setTextColor(getResources().getColor(R.color.dark_white)); Color.parseColor("#1a71d4 ...
- openssl之EVP系列之8---EVP_Digest系列函数具体解释
openssl之EVP系列之8---EVP_Digest系列函数具体解释 ---依据openssl doc/crypto/EVP_DigestInit.pod翻译和自己的理解写成 (作 ...