上一篇文章《让人相见恨晚的vim插件:模糊查找神器LeaderF》归纳性的介绍了LeaderF的基本功能,本篇对LeaderF的新功能作一下介绍。git
随着LeaderF功能的不断增多,LeaderF的命令也在不断的增长,给开发和使用都带来一些不便。因而,LeaderF提供了一个统一的命令接口,就像shell命令同样,不一样的命令选项组合,带来不一样的功能。
能够经过:Leaderf -h
来查看具体使用方法。github
usage: Leaderf[!] [-h] [--reverse] [--stayOpen] [--input <INPUT> | --cword] [--top | --bottom | --left | --right | --belowright | --aboveleft | --fullScreen] [--nameOnly | --fullPath | --fuzzy | --regexMode] [--nowrap] {file,tag,function,mru,searchHistory,cmdHistory,help,line,colorscheme,self,bufTag,buffer,rg} ... optional arguments: -h, --help show this help message and exit --reverse show results in bottom-up order --stayOpen don't quit LeaderF after accepting an entry --input <INPUT> specifies INPUT as the pattern inputted in advance --cword current word under cursor is inputted in advance --top the LeaderF window is at the top of the screen --bottom the LeaderF window is at the bottom of the screen --left the LeaderF window is at the left of the screen --right the LeaderF window is at the right of the screen --belowright the LeaderF window is at the belowright of the screen --aboveleft the LeaderF window is at the aboveleft of the screen --fullScreen the LeaderF window takes up the full screen --nameOnly LeaderF is in NameOnly mode by default --fullPath LeaderF is in FullPath mode by default --fuzzy LeaderF is in Fuzzy mode by default --regexMode LeaderF is in Regex mode by default --nowrap long lines in the LeaderF window won't wrap subcommands: {file,tag,function,mru,searchHistory,cmdHistory,help,line,colorscheme,self,bufTag,buffer,rg} file search files tag navigate tags using the tags file function navigate functions or methods in the buffer mru search most recently used files searchHistory execute the search command in the history cmdHistory execute the command in the history help navigate the help tags line search a line in the buffer colorscheme switch between colorschemes self execute the commands of itself bufTag navigate tags in the buffer buffer search buffers rg grep using rg If [!] is given, enter normal mode directly.
这样就能够用:Leaderf <subcommand> [options]
来执行LeaderF的命令了。例如:shell
Before | Now | |
---|---|---|
:LeaderfFile |
<=> | :Leaderf file |
:LeaderfBuffer |
<=> | :Leaderf buffer |
:LeaderfMru |
<=> | :Leaderf mru |
:LeaderfMruCwd |
<=> | :Leaderf mru --cwd |
... |
每一个子命令都有专有的命令选项,能够用:Leaderf <subcommand> -h
来查看。例如,Leaderf mru -h
:vim
usage: Leaderf[!] mru [-h] [--cwd] [--no-split-path] [--reverse] [--stayOpen] [--input <INPUT> | --cword] [--top | --bottom | --left | --right | --belowright | --aboveleft | --fullScreen] [--nameOnly | --fullPath | --fuzzy | --regexMode] [--nowrap] optional arguments: -h, --help show this help message and exit specific arguments: --cwd search MRU in current working directory --no-split-path do not split the path common arguments: --reverse show results in bottom-up order --stayOpen don't quit LeaderF after accepting an entry --input <INPUT> specifies INPUT as the pattern inputted in advance --cword current word under cursor is inputted in advance --top the LeaderF window is at the top of the screen --bottom the LeaderF window is at the bottom of the screen --left the LeaderF window is at the left of the screen --right the LeaderF window is at the right of the screen --belowright the LeaderF window is at the belowright of the screen --aboveleft the LeaderF window is at the aboveleft of the screen --fullScreen the LeaderF window takes up the full screen --nameOnly LeaderF is in NameOnly mode by default --fullPath LeaderF is in FullPath mode by default --fuzzy LeaderF is in Fuzzy mode by default --regexMode LeaderF is in Regex mode by default --nowrap long lines in the LeaderF window won't wrap If [!] is given, enter normal mode directly.
好多从ctrlp.vim转过来的朋友说不习惯LeaderF自上而下显示结果的方式,想要LeaderF也能像ctrlp同样自下而上(最优结果在最下面)显示结果,为了回馈各位朋友对LeaderF的支持,如今LeaderF也添加了自下而上显示搜索结果的功能:segmentfault
只须要在命令后面加上--reverse
便可,或者也能够一劳永逸,在vimrc里面加上let g:Lf_ReverseOrder = 1
。ui
LeaderF支持用空格(能够用g:Lf_AndDelimiter
来修改)做为And操做符来进行模糊匹配。当匹配已经匹配到字符串末尾时,能够经过敲空格和一个子串来匹配字符串的前面部分,进行快速过滤。
NOTE: 空格分隔的每一个子串都是对整个字符串的模糊匹配,而不是精确匹配。this
能够经过上下键来翻看模糊匹配历史:spa
LeaderF精益求精,永无止境。插件