(Move categories to tip template) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
|previous=807 |
|previous=807 |
||
|next=809 |
|next=809 |
||
− | |created= |
+ | |created=2004 |
|complexity=intermediate |
|complexity=intermediate |
||
|author=Chip Campbell |
|author=Chip Campbell |
||
− | |version= |
+ | |version=6.0 |
|rating=90/29 |
|rating=90/29 |
||
|category1= |
|category1= |
||
Line 13: | Line 13: | ||
}} |
}} |
||
One may overwrite a visual-block of text with another visual-block of text by: |
One may overwrite a visual-block of text with another visual-block of text by: |
||
⚫ | |||
− | |||
− | + | *Select the second block: <code>ctrl-v move c ctrl-o "aP <Esc></code> |
|
⚫ | |||
==Comments== |
==Comments== |
||
Based on the current tip, I've added a little extension to visswap.vim which allows one to |
Based on the current tip, I've added a little extension to visswap.vim which allows one to |
||
− | *Select a region using |
+ | *Select a region using Ctrl-v + motion (visual block). |
+ | *Press Escape. |
||
− | *Hit <escape> |
||
− | *Move cursor to another location, hit \vr (the backslash is actually |
+ | *Move cursor to another location, hit \vr (the backslash is actually <Leader>, so folks may customize that easily). |
− | |||
⚫ | |||
− | \vr multiple times for additional replacements. |
||
⚫ | |||
− | For visswap.vim, see (under "Visual Mode Based Swapping"): |
||
− | http:// |
+ | For visswap.vim, see [http://www.drchip.org/astronaut/vim/index.html#VISSWAP Visual Mode Based Swapping]. |
---- |
---- |
||
− | To make second block exactly same size as first instead of |
+ | To make second block exactly same size as first instead of <Ctrl-v> move hit 1<Ctrv-V> |
− | This will make a rectangular selection of exactly same size as previous one using current cursor position as top left corner. Unfortunately it does not (always? yet?) work with multibyte encodings, |
+ | This will make a rectangular selection of exactly same size as previous one using current cursor position as top left corner. Unfortunately it does not (always? yet?) work with multibyte encodings, so be careful if you use them. |
---- |
---- |
Latest revision as of 05:49, 13 July 2012
created 2004 · complexity intermediate · author Chip Campbell · version 6.0
One may overwrite a visual-block of text with another visual-block of text by:
- Select the first block:
ctrl-v move "ay
- Select the second block:
ctrl-v move c ctrl-o "aP <Esc>
Comments[]
Based on the current tip, I've added a little extension to visswap.vim which allows one to
- Select a region using Ctrl-v + motion (visual block).
- Press Escape.
- Move cursor to another location, hit \vr (the backslash is actually <Leader>, so folks may customize that easily).
That sequence will replace the text in a visual-block fashion below the cursor. One may repeat the \vr
multiple times for additional replacements.
For visswap.vim, see Visual Mode Based Swapping.
To make second block exactly same size as first instead of <Ctrl-v> move hit 1<Ctrv-V>
This will make a rectangular selection of exactly same size as previous one using current cursor position as top left corner. Unfortunately it does not (always? yet?) work with multibyte encodings, so be careful if you use them.