emacs + vimpulse-visual-mode + "linewise" text selection

249 Views Asked by At

Is it possible to make visual-line-mode (one after pressing V from normal mode) conduct as if first mark was in the beginning of the first line of selection and second mark - end of the last line?

For an example, currently after V, j and M-x comment-dwim:

here<cursor>is a
simple example

becomes

here;;  is a
;; simp
le example

whereas desired result is often:

;; here is a
;; simple example

Of course, one can write a wrapper for comment-dwim, but I suspect/hope that there is a more correct solution.

Thank you in advance.

2

There are 2 best solutions below

0
On

comment-dwim calls comment-or-uncomment-region to perform the actual commenting on the marked region. There is no option to extend the region to beginning of the first line and/or end of the last line. You will have to write a wrapper or advice comment-or-uncomment-region to achieve the effect you want.

0
On

Doesn't V (vimpulse-visual-toggle-line) already do that?

Linewise selection will select whole lines. (I use this all the time) The behaviour you're talking about will occur if you're using v (vimpulse-visual-toggle-char).