FZF and VIM
前言
fzf本身并不是一个vim 插件,本来作者只提供了基本的wrapper函数(比如fzf#run). 但后来作者发现很多人并不熟悉VIMScript, 所以就创建一个默认的vim plugin.
为什么在VIM里用fzf?
fzf可以异步地运行,不影响vim操作,比同类的其他插件都快得多。
如何安装
有两种安装方式vundle或vim-plug
vundle
set rtp+=/home/harriszh/.fzf/
...
Plugin 'junegunn/fzf.vim'
vim-plug
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
如果你希望通过vim-plug来安装fzf, 那么使用下面设置
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
vim下支持的命令
这些命令都是FZF调用某个工具产生文件,文件内容, tag, comment, command,然后FZF用一个小窗口把它们显示出来,用户就可以用模糊搜索的方式来选择一个或多个选项,按下enter键后就可以用VIM打开它们或跳转到相应的行。
如Files针对的就是文件, GFiles针对的就是git文件
Command | List |
---|---|
Files [PATH] |
普通文件查找 (similar to :FZF ) |
GFiles [OPTS] |
git文件查找 (git ls-files ) |
GFiles? |
git文件查找 (git status ) |
Buffers |
buffer文件切换 |
Colors |
Color schemes |
Ag [PATTERN] |
ag search result (ALT-A to select all, ALT-D to deselect all) |
Lines [QUERY] |
加载的所有buffer里查找 |
BLines [QUERY] |
在当前buffer里查找包含某关键词的行 |
Tags [QUERY] |
以Tag查找 (ctags -R ) |
BTags [QUERY] |
Tags in the current buffer |
Marks |
Marks |
Windows |
Windows |
Locate PATTERN |
locate command output |
History |
v:oldfiles and open buffers |
History: |
命令历史查找 |
History/ |
Search history |
Snippets |
Snippets (UltiSnips) |
Commits |
Git commits (requires fugitive.vim) |
BCommits |
Git commits for the current buffer |
Commands |
Commands |
Maps |
Normal mode mappings |
Helptags |
Help tags 1 |
Filetypes |
File types |
例子
Files
与FZF
一样的作用,它会列