2

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.

laurent
  • 88,262
  • 77
  • 290
  • 428
arst
  • 21
  • 1

2 Answers2

1

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).

spk
  • 584
  • 5
  • 6
0

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.

Thomas
  • 17,016
  • 4
  • 46
  • 70