0

Suppose that I have a command, say 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?

2
  • Do you want to vi "$(find ABCD | grep text1)" from the commandline or do you want to :! vi "$(find ABCD | grep text1)` from vi ? Commented Mar 9, 2016 at 21:34
  • I want everything to happen from within vim. I don't want to create a new vim process for each file I want to open. Commented Mar 9, 2016 at 21:40

1 Answer 1

4

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`
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.