Vim中使用The Platinum Searcher

在vim中如何使用The Platinum Searcher呢?

我们看到readme中写道

1
2
3
4
5
6
7
nnoremap <silent> ,g :<C-u>Unite grep:. -buffer-name=search-buffer<CR>
if executable('pt')
let g:unite_source_grep_command = 'pt'
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_grep_encoding = 'utf-8'
endif

这个贴到.vimrc就没问题了吗?

显然不是。我们还需要安装unite.vimvimproc.vim

1
2
3
4
Bundle "Shougo/unite.vim"
Bundle "Shougo/vimproc.vim"

# run :BundleInstall

之后需要安装vimproc,cd ~/.vim/bundle/vimproc.vim/ && make

然后就可以在normal mode下使用,g,这样会弹出一个让你输入Pattern:的对话条,输入需要搜索的pattern就行了。

接下来问题是,这个config到底是什么意思?

: 防止输出到命令行上

: 试一下就知道,卷上画面一半

如果你觉得本文对你有帮助,请给我点赞助。