On 10/18/11 09:09, Ben Fritz wrote:
On Oct 18, 7:21 am, Tim Chase<[email protected]> wrote:
On 10/18/11 06:50, Elias Diem wrote:
Without giving the '-' argument to 'less'. Why doesn't this work
with vim?
Because Vim can take piped commands:
[2]tim@bigbox:~/tmp$ seq 10> test.txt
[3]tim@bigbox:~/tmp$ (echo ':5s/$/five'; echo ":wq") | vi test.txt
Vim: Warning: Input is not from a terminal
WHAT?!
That is one of the coolest thing I've learned on the list in a while.
Of course, I have no idea when I'd ever use such a thing.
That's was sorta my reaction as well. I've never actually used it
for anything *practical* but it does allow you to do normal mode
commands too:
[2]tim@bigbox:~/tmp$ seq 10 > temp.txt
[3]tim@bigbox:!/tmp$ echo "3G>4jZZ" | vi temp.txt
Vim: Warning: Input is not from a terminal
[1493]tim@bigbox:~/tmp$ cat temp.txt
1
2
3
4
5
6
7
8
9
10
The only catch is that it's sometimes tricky to do things
involving control-characters or possibly where timing is of the
essence.
Notably, I also tried using
vim -w script.txt filea.txt
to record one vim session into a script, and then playing the
script back into vim on other files:
vim fileb.txt < script.txt
with a disappointing lack of success (in this test case,
filea.txt and fileb.txt were identical to begin with). Ah, well.
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php