(Following on from grawity's explanation, that xargs
points stdin
to /dev/null
.)
The solution for this problem is to add the -o
parameter to xargs
.
From man xargs
:
-o
Reopen stdin as /dev/tty
in the child process
before executing the command. This is useful
if you want xargs
to run an interactive application.
Thus, the following line of code should work for you:
find . -name "*.txt" | xargs -o vim
GNU xargs supports this extension since some release in 2017
(with the long option name --open-tty
).
For older or other versions of xargs,
you can explicitly pass in /dev/tty
to solve the problem:
find . -name "*.txt" | xargs bash -c '</dev/tty vim "$@"' ignoreme
(The ignoreme
is there to take up $0,
so that $@ is all arguments from xargs.)
find
orxargs
at all. Open vim with no arguments, then run:args **/*.txt<CR>
to set vim's arguments from inside the editor.grep -l .. | xargs vim
generates a warning, why? at unix SE