trevcan@internets /dev/human $

adding the fzf plugin to vim

Posted on: 11/27/21 00:37:01
Last edited: 12/01/21 13:50:52

hey there! I don’t know why this came to me but I guess I’ve seen several internet videos in which linuxy users are using a nice, fancy prompt to search files. Turns out they’re using fzf! , a nice tool to easily search for files in the command line. To some degree I guess it is like a dmenu prompt but in a command line. So yeah, by default it acts like a find any file recursively in the current directory, yes, including hidden files; yet still acts like a standard unix command that can take input from stdin (standard input) and only show those choices and of course, prints to stdout the result.

So one can do something like

cat << EOF | fzf
john cena

and that will basically show you an interactive command line prompt which can let you make a choice. This is kind of similar to pedantic software’s choice tool by Sylvain Gauthier and Francois-Xavier Carton. Here’s a blog post from Sylvain in which he explains what his tool does and its uses. I guess it kinda differs to some degree but yeah.

Anyway, back to the fuzzy finder. So after seeing how not so useful this was, at least to me, I decided to make a quick internet search to see if I could use this in vim. And I could! As I’ve already said at the start of this post, I’ve seen several internet humans use vim as a file-finder. So I cloned a sample vim plugin which connects the fzf vim plugin which only gives core functions but doesn’t actually implement anything. So installing all these stuff gives me a pretty prompt like this: fzf in vim

and yeah that’s cool, isn’t it? If you’re interested in how to set it up I’ll put the steps below:

  1. install fzf, can be found in the official Arch Linux repos and pretty much any other distro

  2. install fzf core functions vim plugin; simply clone the official fzf repo to ~/.vim/pack/plugins/start/fzfcore to start the plugin on vim startup.

git clone "" ~/.vim/pack/plugins/start/fzfcore

note: this will only work if you have the vim pack functionality. It probably is if you keep vim up to date. I think this was released in vim 8.0

  1. install fzf.vim as another vim plugin. Same as step 2.
git clone "" ~/.vim/pack/plugins/start/fzf.vim

And that should do the trick. Now just readthedocs @ the fzf.vim docs readme and tldr;: use :Files to search within your home dir, hit enter and the file will be opened in vim. Also, it will show you a small preview (with syntax highlighting, if bat is installed.)

that’s it for this blog post. should probably sleep.

It’s quite simple. No, I didn’t create any of these config files but I guess sharing is caring, right?