Opening files in Vim using Fuzzy Search

前端 未结 4 2146
栀梦
栀梦 2021-01-30 04:01

I\'m looking for a way to make Vim have the ability to open a file by fuzzy-searching its name.

Basically, I want to be able to define a project once, and then have a sh

4条回答
  •  渐次进展
    2021-01-30 04:37

    There are two great vim plugins for this.

    ctrlp:

    • Written in pure VimL
    • Works pretty much everywhere
    • Supports custom finders for improved performance
    • Most popular fuzzy search plugin for Vim

    Command-T:

    • Written in C, VimL and Ruby
    • Fast out of the box
    • Requires +ruby support in Vim
    • Recommends Vim version >= 7.3

    EDIT:

    I use CtrlP with ag as my custom finder and it's incredibly quick (even on massive projects) and very portable.

    An example of using ag with CtrlP:

    if executable('ag')
      " Use Ag over Grep
      set grepprg=ag\ --nogroup\ --nocolor
    
      " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
      let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
    endif
    

提交回复
热议问题