martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.26k stars 260 forks source link

Add visual-block mode CTRL+V #770

Open c99zealot opened 5 years ago

ninewise commented 5 years ago

Could you maybe give an example of what you'd use this for? For the things I remember using visual-blocks for, multiple vertically aligned selections on a continuous range of lines are very similar.

c99zealot commented 5 years ago

I use visual block a lot for removing areas of whitespace used for alignment, removing sections of a column, capitalising a section of a column - anything regarding selecting columns or multiple partial lines.

image

ninewise commented 5 years ago

Open the same file in vis, move to the first A and run 10<ctrl-j>. You'll select the same 10 positions as in your screenshot, but each with a different cursor. Removing areas of whitespace used for alignment or sections of a column will be easier than with visual-blocks.

filipencopav commented 5 years ago

agree++ on what ninewise said, the cursors thing is the alternative for visual block mode in vim

consider closing the thread

Siborgium commented 5 years ago

Multiple cursors feature can do everything visual-block does and more. Agree on closing the thread.

sh4r1k7 commented 4 years ago

To add to ninewise's comment, after creating the cursors hit v to enter visual selection mode to arrive at exactly the same behavior as vim's block mode, ie. (vim) C-v,jje == (vis) C-j,C-j,ve.

ghost commented 4 years ago

One thing vis can not do is set the "block" height by applying any motion to one of its corners, or by using a textobject. <C-j>/<C-k> are just hardcoded special cases for the j and k motions.

Here's a patch that maps <C-v> to a new operator capable of creating selections based on the textobject/motion supplied - https://repo.or.cz/vis/gkirilov.git/commit/refs/heads/patch-lastcol-multisel-operator (posted it on the wiki, too)

vblock