I would like to have a file extension aware :FZF
command, so that when I choose a file with enter from the fzf prompt, and that file has an extension that matches a list (say (pdf|mp3|jpg)
), it opens the file with some external bash command (say open
, I'm on mac), and otherwhise just opens it in vim buffer ar normal.
I have the following in my .vimrc
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': '!open',
\ 'ctrl-v': 'vsplit', }
which lets me open files with an external program with ctrl-x
from the prompts, but my brain can't handle this very well and I often press enter instead of ctrl-x
. One single context aware command would be much better.
!open %
, thenbdelete
, thenb #
) for filetypes like the ones you suggest. I’ll see if I can dig it up – D. Ben Knoble♦ Jan 1 '19 at 17:23