On Apr 14, 10:37 pm, Jorge Timón <[email protected]> wrote:

> what exactly does the + and the , ?
> I understand +,+ jumps a line (so is not deleted), but for the file C
> you just use +

Some "ex"* commands, the ones you enter at the : prompt, can take one
or two "line specifiers".  See
:help 10.3
The comma separates the two specifiers, which give a range.  F. ex. :
4d deletes line 4 and :4,6d deletes lines 4 to 6.  A delete with no
specifiers deletes from the current line, with one specifier from that
line, and two the range given.
The plus specifies the line after the current one.  The :g command
sets the "current" line to be where the pattern matches in turn.  For
"File C" d4|+d deletes 4 lines from where the pattern matches, leaving
the last 2 out of the group of 6, and after that delete the current
line is the one you want and the next is deleted.

So:
A    d2|+,+3d   delete two   lines, then the next to the third after
B    d3|+,+2d   delete three lines, then the next to the second after
C    d4|+d      delete four  lines, then the next
D    d5         delete five  lines

* ex was the predecessor of vi a long time ago, about 35 years I
guess.

BTW, vim precisians,  it occurred to me that specifying a range and a
count may be  contradictory, so I tried it; I am surprised that,
f.ex. :2,4d5 deletes 5 lines from line 4, ignoring the first
specifier.

> after exec, can you write any command?

One writes "ex" commands.  "Normal" commands, like dd or yy, need
the :normal command if you want to put them after exec, or (more
usefully) in a script.

Regards, John

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to