[CLUE-Tech] another vi question

Mike lister-clue at gantsfort.com
Sat Apr 24 23:06:02 MDT 2004


On Fri, Apr 23, 2004 at 10:06:29PM -0600, Mike wrote:
> 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.

Yuck! Let me try this again.

:map ,j /^vbvb(^My5lo^[P                                                        
                                                                                
,j is the macro name these are the two keys you will press to run the           
macro.                                                                          
                                                                                
/^vbvb( is your reg ex search string                                            
^M 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
> _______________________________________________
> CLUE-Tech mailing list
> Post messages to: CLUE-Tech at clue.denver.co.us
> Unsubscribe or manage your options: http://clue.denver.co.us/mailman/listinfo/clue-tech



More information about the clue-tech mailing list