Sunday, March 27, 2011

Missing output from echo command ?

I am trying to learn some scripting.
Because I'm having difficulties in deciphering what I read in :h.
I'm setting up various test text and trying out commands.
I'm getting irreproducible/unexplainable results!

I set up a test file of ~400 lines of downloaded vim_use articles.
Some lines: (100,200,250,350) begin with 'From - ...'
Some lines: (150,230,270,390) are null. {End of header ...}

@ line 150, I try
:let ln = 999 | echo ln | let ln = ('^From - ','W') | echo ln
{This command line is arrived at after much floundering around
to learn that the arguments must be ' delimited, so that
/^From - / is unacceptable, spaces are mandatory, etc...}
I get output
999
200
and the cursor moves to line 200
I repeat @ line 201 ... and @ 351 get
as expected
999
0
and cursor stays at 351

Now I try @ 101
:let ln = ('^$','W') | echo ln
expecting to get
150
and cursor moves to line 150

I get the cursor motion, BUT not the expected :echo ln output of 150 !!
After more playing around, @ 391 I get
0
and no cursor movement

What's going on ???
Also going back to the previous command line:
:let ln = 999 | echo ln | let ln = ('^From - ','W') | echo ln
I no longer get the echo outputs. But I do get the cursor moves
to next ^From - line, UNTIL the last case i.e. @ 350
Then I get
999
0
no cursor movement. i.e. stay on line 350
???

--
Rostyk

--
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

No comments:

Post a Comment