VIM直接查询选中文本
来源:互联网 发布:五年级简便算法公式 编辑:程序博客网 时间:2024/05/22 02:07
在使用Vim的时候会经常用到查询功能,Vim默认的查询往往需要你输入要查询的字符串,要查询的字符串明明已经在文件里面了还要在输入一遍 真是麻烦啊。我就想Vim能不能像某些文本编辑器一样,选中一些文本,查询的时候自动把文本拷贝到查询框。Goolge了一下,果真发现有一个这样的vim tip:
http://vim.wikia.com/wiki/VimTip171
他的主要功能有:
- Press * to search forwards for selected text, or # to search backwards. - 用*向前查询选中词,用#向后查询
- As normal, press n for next search, or N for previous. As normal, press n for next search, or N for previous. - n/N照常
- Handles multiline selection and search. Handles multiline selection and search. (下面的不太用到,就不翻译了:))
- Whitespace in the selection matches any whitespace when searching (searching for "hello world" will also find "hello" at the end of a line, with "world" at the start of the next line). Whitespace in the selection matches any whitespace when searching (searching for "hello world" will also find "hello" at the end of a line, with "world" at the start of the next line).
- Each search is placed in the search history allowing you to easily repeat previous searches. Each search is placed in the search history allowing you to easily repeat previous searches.
- No registers are changed. No registers are changed.
- A global variable (g: VeryLiteral) controls whether selected whitespace matches any whitespace (by default, VeryLiteral is off, so any whitespace is found).
- Type /vl to toggle VeryLiteral to turn whitespace matching off/on (assuming the default backslash leader key). Type / vl to toggle VeryLiteral to turn whitespace matching off / on (assuming the default backslash leader key).
- When VeryLiteral is off, any selected leading or trailing whitespace will not match newlines, which is more convenient, and avoids false search hits. When VeryLiteral is off, any selected leading or trailing whitespace will not match newlines, which is more convenient, and avoids false search hits.
把下面的代码保存为vsearch.vim 放到~/.vim/plugins目录下,就可以使用了
- VIM直接查询选中文本
- jquery实现编辑直接选中文本内容
- mysql直接导出查询数据到文本
- 使用vim在选中的文本中查找替换
- 在vim中直接调用google code search查询代码
- css不能选中文本
- 自动聚焦,选中文本
- 获取选中的文本
- 文本选中背景颜色
- 文本选中效果
- 双击不选中文本
- Edittext文本选中
- 双击禁止选中文本
- css禁止选中文本
- 文本选中事件
- Vim快速选中
- js中查询一段文本并选中查到的所有匹配能实现吗?
- 文本查询
- Mysql 卸载
- 单片机驱动蜂鸣器原理与设计
- 论文参考文献的组织(latex)
- MYSQL 版本选择
- IE6 葬礼
- VIM直接查询选中文本
- error LNK2005:XXXX already defined in XXX.lib
- 中国惠普前总裁孙振耀谈职业生涯规划
- 6.1--如何在主框架窗口或者视图的框架窗口加入一个或多个工具栏?
- 转自JE robbin的博客—程序员的毛病
- 如何制作Windows Mobile手机的桌面主题
- 我的java之路1 -- 有100个不相同数,从里面随机拿出两个,现在只剩余98个数了,求找出拿掉的那两个数
- Dr.COM和Apache冲突的解决方法
- Unique Key 与 Primary Key 的比较