I've got a shell script: find... | stuff | xargs vi
which works fine from the shell. But if I invoke that from inside Vim like :! find... | stuff | xargs vi
it's kinda weird... like maybe I'm seeing different instance of vim that's spawned in a new shell? In that new vim :ls
only shows the new buffer and after doing :q
(from this mystery vim instance) then :ls
shows the previous buffers available.
So do I want to use :e
for this? I was reading several posts about :edit
and :enew
and such, but couldn't figure out how to combine that with this shell pipeline.
edit:
vim seems to be struggling with the shell globbing? and is it not able to accept piped commands through this syntax?
:e `find . -type f -not -path '*/\.*' | shuf -n 1`
E79: Cannot expand wildcards
"`find . -type f -not -path '*/.*'" [New DIRECTORY]
E492: Not an editor command: shuf -n 1`
Press ENTER or type command to continue
results in a buffer:
2 %a "`find . -type f -not -path '*/.*'" line 1
.
in-path '*/\.*'
?:args `find . -type f -not -path '*/\.*' | shuf -n 1`
you try:args `find . -type f -not -path '*/.*' | shuf -n 1`
, since I don't think that backslash is having any effect, but I could be wrong. It appears that the pipe was also part of the issue.