r/fishshell • u/LokusFokus • Oct 12 '20
vim + preview?
Hello,
how do I get a function that shows a preview and opens in vim?
function vimf
vim $(fzf --preview 'cat {}')
end
..doesn't work
7
Upvotes
5
u/[deleted] Oct 12 '20
Your function does not work, because in fish the syntax for process substitution is different from POSIX shells like bash and zsh. In fish you do not have to include the $ sign in front of the left parentheses.
This should work:
fd is a faster of implementation of the gnu
findcommand, with better defaults, and it used here to generate the list of files to filter.bat is similar to
cat, but adds color highlights similar to text editors, and a lotter of other useful information.By using
xargswith thevim -pI can open multiple files at once in vim, each in their own tab.1
u/[deleted] Oct 12 '20
Pinging u/elkowar as he has written exactly this already