Ctrl+K, Ctrl+C is a command no longer working in Visual Studio 2010

五迷三道 提交于 2020-12-31 04:44:29

问题


I am using Visual Studio and Resharper 8.

For some reasons, my favorite shortcut Ctrl+K, Ctrl+C or Ctrl+D no longer works.

Indeed, the application shows in the status bar the message: The key combination is(Ctrl K Ctrl C ) is not a command.

Any ideas how to reset them?

Many thanks.


回答1:


Very strange problem. Yes, it is possible to edit the command in Visual Studio. Select Tools and then Options. Once the window is shown, select the Environment option group and then Keyboard, as shown in the picture below:

enter image description here

There, you can edit the shortcuts:

  • Edit.CommentSelection for commenting a selection (Default shortcut: Ctrl+K, Ctrl+C)
  • Edit.FormatDocument to format the document (Default shortcut: Ctrl+K, Ctrl+D)



回答2:


I have had this issue off and on myself in different versions of VS (now VS 2017). I just figured out that it is a combination of two keys to comment and uncomment code in VS.
To comment code: Press Ctrl+K, then also press C while still holding the Ctrl key. To uncomment code: Press Ctrl+K, then also press U while still holding the Ctrl key. You can release the Ctrl key after pressing K, then press Ctrl+C (or Ctrl+U to uncomment), but is just easier to press the keys in succession.

I had never noticed the status bar at the bottom of the window stating it was waiting on the second key press (C or U).




回答3:


Sorry to resurrect a old thread like this but I have had issues with chording since this whole WFH/Covid-19 thing started. When it first happened the only thing that worked was to reinstall VS 2019. It happened again and this time I reset the keyboard setting back to default and it fixed it with out having to reinstall VS2019. It happened again today. Resetting keyboard settings didn't work and I was not in the mood to re-install so I was living with it for a while. It was after I took a lunch break that I noticed that a light on the top right of my keyboard, which is usually on, was off. It's the light for scroll lock. I hit the scroll lock key, the light came back on my keyboard and suddenly all my short cuts were back.

May not be the answer for everyone but if it's intermittent like mine was, it may be this ridiculous key that I have apparently never hit at work...




回答4:


I also has this issue and found this post, but then realised that ctrl-K wasn't working if code already has a comment within it, Not this is specifically when trying to make a comment in a razor view where there are html comment <!-- --> within the code that needs commenting. This is odd and the first time I have encounter this since the first version of VS.

The solution here is to delete or uncomment that code first.




回答5:


Had the same problem with Format.

Follow the directions in the previous post - if Ctrl+K already appears under Edit.FormatDocument, click on Remove and then define it again as Ctrl+K. A warning will come up saying command Ctrl+K was used to clear bookmarks. This may be the root cause, as Ctrl+K is defined in multiple places by default. Once I redefined it, it worked properly.




回答6:


Visual Studio 2019 here, not using Resharper - CTRL + K, CTRL + C "stopped working".

In my case, the solution was simple.

While editing your files, make sure that you are in the Solution View, not the Folder View.




回答7:


Be sure that you saved the file with .py extension. Otherwise, the software does not perceive the code as command lines and thus does not transfer the lines to comments



来源:https://stackoverflow.com/questions/21141312/ctrlk-ctrlc-is-a-command-no-longer-working-in-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!