Chinaunix首页 | 论坛 | 博客
  • 博客访问: 624749
  • 博文数量: 194
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 884
  • 用 户 组: 普通用户
  • 注册时间: 2015-09-21 16:48
文章分类

全部博文(194)

文章存档

2023年(1)

2022年(3)

2021年(16)

2020年(4)

2019年(5)

2018年(10)

2017年(72)

2016年(36)

2015年(47)

我的朋友

分类: LINUX

2016-01-04 16:38:20

VIM插件: CTRLP[文件搜索]

k-vim配置 


使用频率最高的插件之一

作用: 模糊搜索, 可以搜索文件/buffer/mru/tag等等

github: 原始, 使用的是国人改进版本 

安装

Bundle 'ctrlpvim/ctrlp.vim'

使用

绑定快捷键

ctrl-f模糊搜索最近打开的文件(MRU)

ctrl-p模糊搜索当前目录及其子目录下的所有文件

搜索框出来后, 输入关键字, 然后

ctrl + j/k 进行上下选择

ctrl + x 在当前窗口水平分屏打开文件

ctrl + v 同上, 垂直分屏

ctrl + t 在tab中打开

ctrlp.gif

最终配置

Bundle 'ctrlpvim/ctrlp.vim'
let g:ctrlp_map = 'p'
let g:ctrlp_cmd = 'CtrlP'
map f :CtrlPMRU
let g:ctrlp_custom_ignore = {
    \ 'dir':  '\v[\/]\.(git|hg|svn|rvm)$',
    \ 'file': '\v\.(exe|so|dll|zip|tar|tar.gz|pyc)$',
    \ }
let g:ctrlp_working_path_mode=0
let g:ctrlp_match_window_bottom=1
let g:ctrlp_max_height=15
let g:ctrlp_match_window_reversed=0
let g:ctrlp_mruf_max=500
let g:ctrlp_follow_symlinks=1

其他

  1. 更多操作, 详见 
  2. 可以考虑废弃fuzzyfinder / Command-T
  3. 可以考虑只用一个快捷键, 配置映射到:CtrlPMixed, 就可以一键搜索文件/buffer/mru

附: ctrlp的插件ctrlp-funky

作用: 模糊搜索当前文件中所有函数

github: 

安装

Bundle 'tacahiroy/ctrlp-funky'

使用

绑定快捷键

fu 进入当前文件的函数列表搜索

fU 搜索当前光标下单词对应的函数

ctrlp-funky.gif

最终配置

Bundle 'tacahiroy/ctrlp-funky'
nnoremap fu :CtrlPFunky
" narrow the list down with a word under cursor
nnoremap fU :execute 'CtrlPFunky ' . expand('')
let g:ctrlp_funky_syntax_highlight = 1

let g:ctrlp_extensions = ['funky']

HOSTED ON ALSO . POWERED BY . SOCIAL ICONS BY .

阅读(3755) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~