DSL Tips and Tricks :: Vim tips



Quote
'Insert' isn't used with visual mode, so you're just switching out of visual mode into regular command mode.
I think you may have misunderstood me. I wasn't speculating whether or not insert mode can be used with visual block, because I know it can be.

Press Ctrl+v
Highlight a vertical line
Press Shift+i
Type something (it will first appear on only one line)
Press Esc

After thinking about it, it seems the Shift would be necessary to distinguish between inserting in block mode and switching out.

Quote (mikshaw @ Dec. 11 2007,09:06)
Quote
'Insert' isn't used with visual mode, so you're just switching out of visual mode into regular command mode.
I think you may have misunderstood me. I wasn't speculating whether or not insert mode can be used with visual block, because I know it can be.

I guess I don't  :)

<shift-i> takes you out of visual mode and into regular insert command mode. To get back to block visual mode, you'd have to <exc> out of insert and then <ctr v> again. (at least that's the way it works in 7.1)

I don't know about 7.1; I'm still using 6.3
As it appears to me, the above series of commands does indeed take you out of visual block mode as you said, but not before inserting the typed text on every line that was marked with the visual block.

Quote (mikshaw @ Dec. 11 2007,16:25)
I don't know about 7.1; I'm still using 6.3
As it appears to me, the above series of commands does indeed take you out of visual block mode as you said, but not before inserting the typed text on every line that was marked with the visual block.

Hey....that works!   Although the highlighting goes off and and shifts out of visual mode, the esc key indeed writes to the previously highlighted column.  That's very cool....Thanks for finding that little gem!  Having the visual mode is much faster that using the automated key function, with the added advantage that you don't have to know the exact number of lines to repeat  (because you can see and adjust the highlighted column before running the task).

(BTW....I'm not sure how you found that trick....you're not reading the manual, are you? )  
:)

Edit: That certainly was a timely tip; saved me at least an hour this evening!!

Quote (mikshaw @ Dec. 10 2007,21:28)
Quote
Here's one of my fave "cheatsheets":
http://www.rayninfo.co.uk/vimtips.html
a lot of stuff to digest there.

I'm also going through it.  First thing I spotted:

" :'a,'bg/fred/s/dick/joe/igc  VERY USEFUL "

Very cryptic  :)

I like the 'fold' feature, which saves opening up several copies and getting a lot of .swp files, etc..   Thanks for the links!

Next Page...
original here.