Vim: Ctrl+c in insert mode does not copy text, and unexpectedly switches to normal mode

Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

Ctrl+c in insert mode.

What did you expect to happen?

I expect normal VS Code features to work in insert mode, in this case for the selected text to be copied, and to remain in insert mode.

What happened instead?

Nothing was copied, normal mode was entered.

Technical details:

  • VSCode Version: 1.10.2
  • VsCodeVim Version: 0.6.11
  • OS: Windows 10

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 60
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I know this is a late reply, but if you to specifically only disable certain keys (in this case CTRL+C) from this extension, put the following in your settings.json:

"vim.handleKeys":{
  "<C-c>": false
}

If mac you can replace C(Ctrl) with D(command)

"vim.handleKeys":{
  "<D-c>": false
}

This is normal Vim behavior. If you want it turned off, you can set vim.useCtrlKeys to false.

Coming from Visual Studio and using the VsVim extension doesn’t require to go through hoops to use use Ctrl+C, X, V

This fixed it for me in settings.json:

{
	"vim.handleKeys": {
		"<C-c>": false,
		"<C-x>": false,
		"<C-v>": false
	}
}

For people like me that didn’t know where the settings.json file can be found, details here

I faced same issue

I SOLEVED IT BY

  • disabling vim extension in vscode

  • uninstaling vim extension

In settings.json I have added:

"vim.overrideCopy": false,

From the readme it says:

Override VS Code’s copy command with our own, which works correctly with VSCodeVim. If cmd-c/ctrl-c is giving you issues, set this to false and complain here.

"vim.handleKeys":{
  "<C-c>": false
}

Is it possible to disable <C-c> in insertion mode only (i_CTRL-C), such that it still works in normal mode? For instance, it would copy in insertion mode and still abort a :command in normal mode.

For some reason setting this in settings.json: "vim.useCtrlKeys": false doesn’t solve the problem. Ctrl+c still activates the normal mode.

The same problem.

For some reason setting this in settings.json: "vim.useCtrlKeys": false doesn’t solve the problem. Ctrl+c still activates the normal mode.

I’ll just make this slightly more clear for anybody stopping by

By default, while in insert mode Vim uses the Ctrl+C command to switch to normal mode. But you may want to retain the original use of Ctrl+C (copying text). To do this you may have heard that you must set the vim.useCtrlKeys setting to false. But many of us have found that this still does not fix the problem! If that’s you, here’s how you solve it:

  1. Open the settings by pressing Ctrl+, (or in the top-left corner click File->Preferences->Settings)
  2. Enter this string into the settings search bar: “vim command override”. You will see a handful of settings below
  3. Uncheck the checkbox for the “Vim: Override Copy” setting
  4. Uncheck the checkbox for the “Vim: Use Ctrl Keys” setting

image

What’s important to note is that you must set both the “Vim: Use Ctrl Keys” and the “Vim: Override Copy” settings to false. Just doing one or the other will not fix the problem

I’ll just make this slightly more clear for anybody stopping by

By default, while in insert mode Vim uses the Ctrl+C command to switch to normal mode. But you may want to retain the original use of Ctrl+C (copying text). To do this you may have heard that you must set the vim.useCtrlKeys setting to false. But many of us have found that this still does not fix the problem! If that’s you, here’s how you solve it:

  1. Open the settings by pressing Ctrl+, (or in the top-left corner click File->Preferences->Settings)
  2. Enter this string into the settings search bar: “vim command override”. You will see a handful of settings below
  3. Uncheck the checkbox for the “Vim: Override Copy” setting
  4. Uncheck the checkbox for the “Vim: Use Ctrl Keys” setting

image

What’s important to note is that you must set both the “Vim: Use Ctrl Keys” and the “Vim: Override Copy” settings to false. Just doing one or the other will not fix the problem

thanks. this solved my problem

@johnfn I tested this on the latest version of Vim, and it is not normal Vim behavior. You can use Ctrl+c, Ctrl+v, Ctrl+z, to name a few in Vim in insert mode.