Weiguang Shi wrote:
I was wondering if there is a plan to add the feature of Normal-mode
editing within a visual block. This would be very useful when drawing
ASCII figures in Vim, when you want to focus on and make changes in
a region. I haven't seen so far scripts smart enough to support, e.g.,
the Normal command 'ddp' to swap two lines _within_ a visual block,
and think the bigger goal, Normal-mode editing within visual blocks,
may be better supported natively by Vim. That is, to make editing
recursive with regard to visual blocks (or anything that marks a
Please point me to the obious if I missed it.
To draw ASCII figures within an area of text, I suggest Virtual-Replace
mode (see ":help gR" and ":help Virtual-Replace-mode") with
'virtualedit' set to "all".
To be able to swap lines within a visual block, I suggest:
1. delete the block
2. put it after the end of the file
3. edit it there
4. mark it again, blockwise, and check that the block is still rectangular
5. delete, then put it back where it belongs.
Vim treats each line as an entity: swapping lines is basically (IIUC)
just pointer manipulation. Treating a blockwise selection as if it were
a file without moving it might be something else altogether. Now what
might be feasible in Vim-script (and maybe Dr. Chip has already done it,
I haven't checked) would be a mapping which would extract the current
block selection to a separate Vim window so you could edit it in its own
buffer; and another mapping to close the auxiliary window and reinsert
the modified text where it came from.