3 ms·
There's a better way: type vim $(fzf) but don't press enter. Press tab instead. The shell will expand the $(), which will run fzf and let you choose a fil
by _dain_ 4y ago
There's a better way: type
vim $(fzf)
but don't press enter. Press tab instead. The shell will expand the $(), which will run fzf and let you choose a file. When you've made your choice, fzf will exit, and your choice will be written in place of the $(), so you can see the result before you run it. It works with any command, not just vim. It's particularly useful when doing multi-selects. And if you press ESC then nothing gets written.
I've only tested this with zsh, not sure how other shells behave. And you may need to alter fzf's default command or pipe something into it.