Reputation: 21
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.
Upvotes: 2
Views: 244
Reputation: 594
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).
Upvotes: 1
Reputation: 17412
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.
Upvotes: 0