[CLUE-Tech] another vi question
Mike
lister-clue at gantsfort.com
Fri Apr 23 22:06:29 MDT 2004
On Sat, Apr 24, 2004 at 08:48:37AM +0800, thadphole wrote:
> suppose i need to copy some characters or words from a line, not the
> entire line, how will i do that, e.g.
> i want to copy the first 5 charcters of this sample to next line:
>
> vbvb(llll)
> ^^^^^
Do you have any experience writing macros? Here's one way I found to do
it. Define a macro as follows
:map ,j /^vbvb(
y5loP
,j is the macro name these are the two keys you will press to run the
macro.
/^vbvb( is your reg ex search string
is the enter key. NOTE!! This is not ^ followed by M. This is entered
by typing Ctrl+V,Ctrl+Enter.
y5l copy the first 5 characters
o open a new line below the current line
is the escape key seqence similar to before this is Ctrl+v,Ctrl+Esc
P put (or paste if you prefer) the copied characters. Capital P means
before the cursor as opposed to lower case p which means after the
cursor.
HTH,
Mike
More information about the clue-tech
mailing list