vim的插件不能重新vim map 映射 按键键吗

你应该知道的vim插件之surround.vim
写代码的时候你会发现这个插件是多么有用!
强烈推荐!
0×01.change
123456cs&'
cs)]
1234567891011文本 & & & & & & &命令 & & & &结果
--------------- & ------- & &-----------
&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!'
(| 为光标位置)
0×02.adding
比如,我要把这个小标题外围用strong标签包括起来,再也不用像以后那样
敲了,只需要:
1yss&strong&
12345678910Text & & & & & & &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 等 )。
一些插入模式时的例子:
12345678Command & & & & & & & & &New Text
------- & & & & & & & & &------------
&CTRL-s&& & & & & & & & &&&
&CTRL-s&&CTRL-s&&html& & &html&
& & & & & & & & & & & & & & &|
& & & & & & & & & & & & &&/html&
(| is the position of cursor in these examples)
0×03.delete
全部命令和快捷键参考:
123456789101112131415161718192021Normal 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&
下载地址:
更多信息,详见:
1:h surround
本文参考资料:
Leave a ReplyVim插件--Nerdtree的使用及快捷键 - 简书
Vim插件--Nerdtree的使用及快捷键
Nerdtree的***
进入.vim/bundle目录.
执行git clone .
下载完成后,在bundle下会多出一个nerdtree的文件夹,所有相关插件都在该文件夹下.
在终端进入项目文件夹, 输入vim .,即可看到树形目录.
h j k l移动光标定位ctrl+w+w 光标在左右窗口切换ctrl+w+r
切换当前窗口左右布局ctrl+p
模糊搜索文件gT 切换到前一个tabg t 切换到后一个tab
可以在.vimrc里为标签页进行的配置,通过ctrl h/l切换标签等 let mapleader = ',' nnoremap &C-l& gt nnoremap &C-h& gT nnoremap &leader&t : tabe&CR&
o 打开关闭文件或者目录,如果是文件的话,光标出现在打开的文件中O 打开结点下的所有目录X 合拢当前结点的所有目录x 合拢当前结点的父目录
i和s水平分割或纵向分割窗口打开文件u 打开上层目录t 在标签页中打开T 在后台标签页中打开
p 到上层目录P 到根目录K 到同目录第一个节点J 到同目录最后一个节点m 显示文件系统菜单(添加、删除、移动操作)? 帮助:q 关闭

参考资料

 

随机推荐