简体   繁体   中英

Vim: How to open a file whose name is determined by running a shell command

Suppose that I have a command, say find ABCD | grep text1 find ABCD | grep text1 which outputs full-path of a file to be opened. I know I can send this output to vim using xargs and open the file, but this is possible only in command line.

How can I do this from inside vim editor?

Assuming COMMAND returns exactly the path of your file, then something like this should be ok from the command line:

$ vi $(COMMAND)

and this should be ok from within vim:

:e `COMMAND`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM