1

Topic: Ctrl-C not exiting Insert mode in VS

Background:  I had to perform a re-install of my licensed version of ViEmu for VS after VS inadvertently upgraded me to an un-licensed / latest version of ViEmu for VS

Once the licensing issue was sorted, I discovered that Ctrl-C stopped working while in Insert mode.  This has always worked to return me to Normal mode, but no longer.

<C-c> works fine in ViEmu for SSMS for the same function of returning to Normal mode.

I tried :inoremap <C-c> <Esc> in VS, but it had no effect.

Keyboard mappings in both VS and SSMS appear similar for ViEmu.KeypressCtrlC
- VS: Ctrl+C (Text Editor)
- SSMS: Ctrl+C (SQL Query Editor)

So I'm at a loss as to how to restore the function of <C-c>

2

Re: Ctrl-C not exiting Insert mode in VS

After another round of uninstalling and reinstalling, Ctrl-C functionality has returned.

This issue may be considered closed.

3

Re: Ctrl-C not exiting Insert mode in VS

Thank you John for posting this followup, I came here to do the same.

For anyone interested, Ctrl-C should be assigned to ViEmu.KeypressCtrlC (which it is by default after installing ViEmu), and this is interpreted as a native keypress by ViEmu's vi emulation core (no :inoremap / :map / :imap necessary). I'm not sure why the keypress was not getting to the right place, it may be due to a glitch in the VS command mapping that was resolved when reinstalling.

When checking the code, I have realized that ViEmu's emulation is not completely faithful. In vim, if you exit insert mode with Ctrl-C instead of Esc, any repetition number that had been entered with the insert command (i, o, a, A...) is ignored. That is, if you type 5ihello<esc>, that types "hello" 5 times, but if you type 5ihello<ctrl-c>, that only types one "hello" in vim, but it types 5 in ViEmu. I will probably fix this in the next version of ViEmu - hope it is not a problem for anyone! Of course :inoremap <ctrl-c> <esc> will do the trick to restore the current behavior, and I think it is better that default behavior be as close to vim as possible.

Regards,

  -- Jon

4

Re: Ctrl-C not exiting Insert mode in VS

Another followup -

Behavior reverted after another instance of VS auto-updated to newest version of ViEmu.

Solution was first to try uninstall/reinstall licensed version and Set Keybindings.  This didn't resolve the issue.

Reviewed VS Keyboard mappings.  I found that Edit.Copy was also using Ctrl-C, so I removed that mapping.  ViEmu functionality for Ctrl-C was then restored.

Last edited by jjturner (2021-01-18 18:00:44)

5

Re: Ctrl-C not exiting Insert mode in VS

Thanks John. That makes sense. If Ctrl-C is mapped to Edit.Copy (the default for VS), then the keypress doesn't get to ViEmu. ViEmu by default removes that keybinding, so that its ViEmu.KeypressCtrlC keybinding can take hold, but I guess the auto-update mechanism botches that somehow -- the autoupdate is done automatically by VS's extension manager, it is not possible to know exactly how it is managed.

Regards -- Jon