1

Re: Problem with ViEmu selection

VS2010, Win 7 Pro x64
ViEmu 2.5.11

When I select lines and use VS's surround-with command, the formatting is broken.

For example:

void main()
{
    int a;
    int b;

    doSomething();
    doSomethingElse();
    bye();
}
Put cursor on the line with doSomething(), go down one line, use the chord Ctrl-K, Ctrl-S, select #if.  Here's the result:
#if true
            doSomething();
    doSomethingElse();
 
    #endif    bye();

Is there anyway to improve this -- line selection -- so the two do... lines are surrounded?

2

Re: Problem with ViEmu selection

Number8, this is not ViEmu, but VS standard behavior. If you put the cursor at the beginning of doSomething() and press down two times with Shift pressed (to extend the VS selection to the two doSomething lines) and then use Ctrl-K, Ctrl-S (with or without ViEmu enabled), you get the same behavior.
Visual Studio doesn't have a line selection exactly the way Vim does, so the ViEmu visual line range when the 'use VS selection for Visual Mode' setting is active is an approximation to Vim behavior within the limits of VS selection.
To achieve the behavior you want, you'll need to enter visual mode in character mode, not line mode, and select up to the end of the doSomethingElse line. With that selection made, the VS surround-with command will do what you need.
Another possibility is to work with Vi default visual range (not set the 'use VS selection for Visual Mode') and when you need to apply a VS command that works on a selection, use gS to turn the visual range into VS selecion prior to executing the VS command. This way you can use the visual line mode to select the two lines you want to surround.
I hope that helps...

-- Isaac

3

Re: Problem with ViEmu selection

Thanks for the reply; I thought it might be a limitation with VS selections.
I did not know about gS, I'll try to remember to use that and see how it works.