1

Re: uncommenting in Visual Line mode

Hi!

My company recently got me a license for ViEmu and I love it!

I am having the following issue, which could just be a misunderstanding on my part (I'm fairly new to Vim in general):

I have the following in my _viemurc:

map <C-k> gS:vsc Edit.CommentSelection<CR>
map <C-S-k> gS:vsc Edit.UncommentSelection<CR>

When I select multiple lines of code using Visual Line mode and then press Ctrl-k, I get what I expect, which is that the entire selected block of code is commented out.
However, when I highlight a block of code that is already commented out (again, using Visual Line mode), and press Ctrl-Shift-k, only the line on which the caret lies actually gets uncommented.  Has anyone else seen this?  Interestingly, if I first press gS to change the selection to a VS selection, and then press Ctrl-Shift-k, my code is uncommented as expected.  I have gS in my mappings (as shown above), so I'm not sure what the problem could be.

Thanks!

2

Re: uncommenting in Visual Line mode

No one has experienced this issue?

3

Re: uncommenting in Visual Line mode

Dreyln, apologies for not getting back to you earlier. Apart from the holiday family celebrations, I've moved to a new home and only started to be able to catch up today. I'll check this (and the other pending issues on the forum), and post back here about this during this week.

These kinds of features easily cause compatibility issues, so I might have to tweak ViEmu and prepare a new build in order to fix it.

Happy new year and best regards,

  -- Jon

4

Re: uncommenting in Visual Line mode

Hi Jon,

I would like to add the this post as I have noticed similar behavior with the selection.

Visual mode selection doesn't appear to be the same as VS editor selection. When I select several lines and then try to perform a refactoring using ReSharper it doesn't recognize that I have any text selected.

In a similar way if I try to comment all selected lines using the Ctrl+k, ctrl+c chord only the current line is commented. Note that this is a VS feature and not a ReSharper one.

In fact if I select several lines using shift+V and then drag over the text I can actually see a second selection that can be manipulated using VS (e.g. dragged to a new location).

Is this expected behavior?

Regards,

Mike

5

Re: uncommenting in Visual Line mode

Mike,

I believe what you are describing is the expected behavior for viemu.  Viemu uses a selection scheme independent from the VS editor unless you have "Use Visual Studio selection mode for Visual Mode" checked in the options.  The issue I'm seeing has something to do with mappings as I'm changing the selection to be a Visual Studio selection via "gS" and then triggering the Edit.UncommentSelection VS command.

If you do want the viemu selection to be the same as the VS editor selection, you can enable that option as described above and it works fine.

6

Re: uncommenting in Visual Line mode

Thanks for that tip. It now works as expected.

Mike

7

Re: uncommenting in Visual Line mode

Dreyln, thanks for explaining the details to Mike! Mike, indeed, the above explanation is perfect. The VS selection works fine, but there are certain limitations which took me to implement the other option. For one, VS can't display the cursor anywhere but at one of the end points of the selection, so even if ViEmu internally keeps the "real cursor position" while in real mode, it can't really be shown (press V with the cursor in the middle of a line, with the "Use VS Selection setting" enabled, to see what I mean).

Dreyln, thanks again, and I'll try to look into the original issue later this week.

Best regards,

  -- Jon

8

Re: uncommenting in Visual Line mode

Doh!

I just figured out what my problem was.  I already had the VS command UncommentSelection bound to Ctrl-Shift-k, so it was interfering with my viemu mapping.  Uhg.... sorry about the false alarm.

Still loving ViEmu after a few months of using it (loving it more, actually)!

9

Re: uncommenting in Visual Line mode

Dreyln, no problem at all! I'm glad it's now fixed. Thanks for the kind comment too, much appreciated!

Regards,

  -- Jon