linux - Why doesn't "history | vim" work? -
i want use vim see result of history
(not in shell). think history | vim
work (use result of history
input of vim
), returns with:
$history | vim vim: warning: input not terminal vim: error reading input, exiting... vim: finished.
can explain this?
by piping vim, changing standard input stream. because vim interactive program, requires standard input console.
if want view in vim, should tell reading file stdin (by supplying argument -
):
history | vim -
alternatively, use more or less:
history | more history | less
these latter 2 preferable. if pipe vim, see "file" having modifications, , can't quit straight :q
command. instead have force quit :q!
, bit clunky.
on other hand, can exit more or less typing q
. have @ man-page these 2 programs. you'll use them lot.
as recommended russell silva in comments, can open vim in read-only mode when read stdin. supply -r
argument. can quit without needing override:
history | vim -r -
Comments
Post a Comment