How can you run a command in your normal shell and then pipe it to Vim?
A typical use case could be to run a find
command and open the found file in Vim.
Answer: You can use command substitution.
vim $(find . -name example.txt)
Here’s a useful command that I’m using now:
nvim (fd | fzy)
(I’m using fish
as my interactive shell. Thus I don’t need to use $
. In bash, you’d type nvim $(fd | fzy)
).
fd
is a faster and more intuitive alternative to find
.fzy
is a fuzzy text selector.
Running nvim (fd | fzy)
will open a terminal selection option where you can type in the filename you’re searching for. Hitting the Enter key will open the file in NeoVim.