如何在Visual Studio代码中切换高亮文本的情况?VS允许通过CTRL+SHIFT+U和CTRL+U。
是否有我可以设置的命令绑定来执行此操作,或者它是默认的一些其他组合键?
如何在Visual Studio代码中切换高亮文本的情况?VS允许通过CTRL+SHIFT+U和CTRL+U。
是否有我可以设置的命令绑定来执行此操作,或者它是默认的一些其他组合键?
当前回答
摘自这篇文章:
The question is about how to make CTRL+SHIFT+U work in Visual Studio Code. Here is how to do it. (Version 1.8.1 or above). You can also choose a different key combination. File-> Preferences -> Keyboard Shortcuts. An editor will appear with keybindings.json file. Place the following JSON in there and save. [ { "key": "ctrl+shift+u", "command": "editor.action.transformToUppercase", "when": "editorTextFocus" }, { "key": "ctrl+shift+l", "command": "editor.action.transformToLowercase", "when": "editorTextFocus" } ] Now CTRL+SHIFT+U will capitalise selected text, even if multi line. In the same way, CTRL+SHIFT+L will make selected text lowercase. These commands are built into VS Code, and no extensions are required to make them work.
其他回答
我写了一个Visual Studio Code扩展来更改大小写(不仅仅是大写,还有许多其他选项):https://github.com/wmaurer/vscode-change-case
要将大写命令映射到按键绑定(例如Ctrl+T U),单击File -> Preferences -> Keyboard shortcuts,并将以下内容插入到json配置中:
{
"key": "ctrl+t u",
"command": "extension.changeCase.upper",
"when": "editorTextFocus"
}
编辑:
随着2016年11月VSCode的更新(发布说明),内置了通过命令editor.action.transformToUppercase和editor.action.transformToLowercase转换为大写和小写的支持。这些没有默认的键绑定。
更改大小写扩展对于其他文本转换仍然有用,例如camelCase, PascalCase, snake-case等。
以下是justanotherdev的评论:
令人兴奋和有用的:
命令面板:CTRL + SHIFT + p (Mac: CMD + SHIFT + p) 输入>transform pick大写/小写并按enter
对于那些害怕在vscode json设置中搞砸任何事情的人来说,这是很容易遵循的。
Open "File -> Preferences -> Keyboard Shortcuts" or "Code -> Preferences -> Keyboard Shortcuts" for Mac Users In the search bar type transform. By default you will not have anything under Keybinding. Now double-click on Transform to Lowercase or Transform to Uppercase. Press your desired combination of keys to set your keybinding. In this case if copying off of Sublime i will press ctrl+shift+u for uppercase or ctrl+shift+l for lowercase. Press Enter on your keyboard to save and exit. Do same for the other option. Enjoy KEYBINDING
使用快捷键“Ctrl + Shift + P”打开命令面板提示符。
在命令中,调色板开始输入您希望转换的文本大小写,例如小写或大写,然后选择相应的选项,如下图所示。
我认为这是目前缺少的功能。
我注意到,当我做一个指南,键盘快捷键之间的区别,它和Sublime。
虽然这是一个新的编辑器,但如果他们在新版本中添加它,我不会感到惊讶。
来源:https://code.visualstudio.com/Docs/customization