Ⅰ. 插件描述
Boolean-logic patterns, based on LogiPatⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/boolpat-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/boolpat-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/boolpat-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/boolpat.vim
Ⅳ. 文档说明
This is just like vimscript #1290 but with simpler syntax.
:BoolPat {expr}
converts boolean-logic pattern {expr} into a normal regexp pattern and searches for it. Basically, {expr} can be any regexp pattern with some special characters in it for boolean operators:
! is logical NOT, | or || is logical OR, & or && is logical AND
(...) is for grouping, whitespace separates items, '...' quotes characters
Quoting: Single quotes '...' literally include special characters and whitespace in the pattern. Two single quotes '' result in one single quote, inside or outside of '...'.
:BoolPat abc
will search for lines containing the string "abc", using the pattern .abc.
:BoolPat !abc
will search for lines which don't contain the string "abc", using the pattern ^%(%(abc)@!.)*$
:BoolPat abc|def
will search for lines which contain either the string "abc" or the string "def"
:BoolPat !(abc | def)
will search for lines which don't contain either of the strings "abc" or "def"
:BoolPat abc & def
will search for lines which contain both of the strings "abc" and "def"
:BoolPat abc' & ''def'
will search for lines which contain the string "abc & 'def"
:BoolPat abc''def
will search for lines which contain the string "abc'def"