Ⅰ. 插件描述
Boolean-Logic PatternsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/logipat'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/logipat'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/logipat'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/LogiPat
Ⅳ. 文档说明
LogiPat takes Boolean logic arguments and produces a regular expression which is used to search for a line satisfying the logic. The search register (@/) is initialized with the resulting regular expression, so repeating such searches is as easy as repeating any search. A series of examples follows:
:LogiPat "abc"
will search for lines containing the string "abc"
:LogiPat !"abc"
will search for lines which don't contain the string "abc"
:LogiPat "abc"|"def"
will search for lines which contain either the string "abc" or the string "def"
:LogiPat !("abc"|"def")
will search for lines which don't contain either of the strings "abc" or "def"
:LogiPat "abc"&"def"
will search for lines which contain both of the strings "abc" and "def"
:let pat= LogiPat('!"abc"')
will return the regular expression which will match all lines not containing "abc". The double quotes are needed to pass normal patterns to LogiPat, and differentiate such patterns from boolean logic operators.
(alpha/beta version available at http://www.drchip.org/astronaut/vim/index.html#LOGIPAT)