[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VI Tricks



Gary,

Is it possible to yank only part of lines?  example half of line 2, all of lines 3-6, and half of line 7 ...

I often find myself wanting parts of multiple lines and that is why I end up using the "v" or visual method.  (I don't have mouse support enabled on some of the machines I log into)  Maybe there is a faster way than highlighting to accomplish this?

Thanks,

jburke.

On Tue, Apr 16, 2002 at 12:12:13PM -0500, Gary wrote:
> On Tue, Apr 16, 2002 at 10:27:18AM -0500 or thereabouts, James L. Burke wrote:
> > On Mon, Apr 15, 2002 at 09:48:07AM -0500, Flood Randy Capt AFCA/TCAA wrote:
> > > 
> > > It's been my experience that vi rocks and that everyone that uses it seems to know at least one trick that I do not know that is really useful and cool.  So, if you use vi, please share some useful commands that I might not know.
> > 
> > I'm relatively new to vi, but since switching to mutt for my mail reader I've started to get used to using vi for a large portion of my editing.  Since I normally use OpenOffice.org swriter to do my word processing, I was looking for a way to "highlight" sections of text within vi (even pico can do that ...)
> > 
> > Sure enough ... you can turn on and off the "visual" status by hitting the "v" key.  After you have a section highlighted, you can perform editing commands to this section separately ... for example you can "yank" the section and then "paste" the section somewhere else ... I've seen Steve Pritchard do this faster with other commands, but I don't use vi enough yet to remember those arcane commands ;)
> 
> Don't even need to highlight, (which your mouse will do too), just ESC
> and N(number of lines) yy to yank... ESC 3yy will yank the current line
> plus the next 2 lines... 
> 
> VIM has 26 buffers, after the alphabet.. the normal yy command is for
> the first un-named buffer.. To use a named buffer, just use ESC " (just
> one " (quote mark), plus the name of the buffer, Like so:
> 
> ESC "ayy moves current line into buffer A
> 
> ESC "ap  pastes what is in current buffer A to the right of the cursor.
> 
> ESC "aP  pastes what is in current buffer A to the left of the cursor.
> 
> another example
> 
> ESC "b4dd  would delete 4 lines and place them into named buffer B
>  
> > "visual" editing in vi ... great newbie tool.
> 
> Once you get used to it, VIm is extremely fast 
>  
> 
> -- 
> Best regards,
> Gary   
> 
> 
> -
> To unsubscribe, send email to majordomo@silug.org with
> "unsubscribe silug-discuss" in the body.

-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.