I am trying to redirect the output of a bash command into a new file.
If I try the pipe as below :
ls -la | vim
Bash shows me the errors :
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
I know that I can open Vim and then use :
:r !ls -la
But is there a way to do this in bash itself, so that Vim is opened and the output is pasted there automatically?
<(ls -la)is actually process substitution rather than command substitution. – Eliah Kagan Sep 02 '14 at 01:32-Ror-c "setlocal buftype=nofile bufhidden=hide noswapfile"to avoid this. – Jérôme Pouiller Dec 11 '20 at 12:24ls somdir/and then after it dumps output, i can search and yank from it? Much appreciated!!! – Evan Morrison Jan 28 '21 at 06:17vwhile typing a command in bash brings up the command invim. But just the command... – Tom Russell Feb 28 '21 at 20:49ls -la | vimin bash results inVim: Warning: Input is not from a terminalandvimjust exits. Butvim <(ls -la)works for me As does itsgvimanalog. – Tom Russell Feb 28 '21 at 20:50-(minus) after the command to tell vim to read from the stdin. – chaos Feb 28 '21 at 23:02