Open Multiple Files at Once with FZF and Vim

We'll cover how to open multiple files in a vertical or horizonal split as well as in the same buffer or a new tab.
When your FZF window is open you can select 1 or more files with Shift + TAB.
By default you’ll see a little > character next to the selected files.
Then you have a few options depending on how you want to open the file and how you might have your key maps set up. For example if you’re using my dotfiles you can do:
Enteropens each file as a bufferCTRL + vopens each file in a new vertical splitCTRL + bopens each file in a new horizontal splitCTRL + topens each file in a new tab
Those key maps come from this part of my .vimrc:
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-b': 'split',
\ 'ctrl-v': 'vsplit'
}
Overall this can be useful if you search for something like “users” and then quickly open a controller, view and tests from the same FZF search window. I do it occasionally.
The video below demos how this works.
# Demo
Timestamps
- 0:12 – Demoing how it works
- 1:36 – You can open as many files as you want
- 1:56 – Configuring things in Vim
- 2:26 – Use cases?
Have you used this shortcut recently? Let me know below.