When it comes to Vim’s fuzzy lookup plug-in, many people’s first reaction is CTRLP. Vim, CTRLP is well-known, but compared with other similar plug-ins, its only advantage is written in vimL (which makes its performance is the worst among all similar plug-ins). This paper recommends a fuzzy search plug-in — LeaderF, which far exceeds CTRLP in terms of performance and matching accuracy.

LeaderFWhat is?

LeaderF is a Vim plugin written in Python that can quickly find target files in hundreds of thousands of files by fuzzy lookup. It also has many derivatives: quickly open or locate a buffer, recently used files (MRU), tags (including functions, classes, variables, etc.), command history, a line in a file, Vim’s help, marks, and more.

Find files

File lookup is a common operation of Vimers, and many Vimers desperately need to quickly locate target files in massive files, hence plug-ins like CTRLP. But CTRLP performance is not good, and sometimes the name of the target file is entered into the search bar or can not find the target file, the biggest problem is its fuzzy matching algorithm is not good, often in front of the far from what you want to find. LeaderF solves these problems perfectly with asynchronous retrieval and a well-designed fuzzy matching algorithm. When you press the search command in the root directory (/), there is no longer the urge to cut off your hands; Find files in fewer keystrokes, extending your keyboard life 🙂

  • Asynchronous retrieval



    Asynchronous retrieval

  • Fuzzy search



    Fuzzy search

  • Regular expression lookup



    regular

  • Multi-byte character lookup (Chinese lookup)



    Chinese

Quickly locate tags (including functions, classes, variables, and so on)

With this, the tagbar can be eliminated:





tags

Find History command





History

Switch Colorscheme





Colorscheme


Of course, there are other functions are not a display, interested partners can view here.

Details you don’t know

  • smartcase

If the search characters entered are all lowercase letters, the match is case insensitive; If uppercase letters are entered, only uppercase letters are matched, and lowercase letters are still case insensitive. For example, enter abcDef to match the following strings:

abcDef
AbcDef
abcDEf
aBcDeF
Copy the code

But cannot match:

abcdef
Abcdef
Copy the code

Note: ABC and EF are still case insensitive so that you can quickly narrow down the search by using uppercase letters.

  • Open multiple files at the same time



    Open multiple files at the same time

  • Refining search results



    Refining search results

Out of the box

All of the above features do not require additional configuration, just install the LeaderF plug-in to use, unlike some plug-ins, configuration is like a new scripting language.

The last

LeaderF also has support for writing extensions, here is an example.

LeaderF, perhaps Vim’s best fuzzy query plugin