![](/img/trans.png)
[英]Keybinding for Format Code -> Shift+Alt+F in VS Code does not seem to work
[英]Why does shift/alt keyboard combination work for default bindings but not my custom ones? (VS Code)
在Fedora Linux / Gnome和VS Code 1.36.1中, "key": "shift+alt+right"
的原始綁定可以正常工作,但是我無法讓自定義的東西做任何事情。
我將添加到keybindings.json
並嘗試了各種密鑰。
當我使用鍵盤快捷recording keys
和recording keys
模式時,它可以很好地拾取它們。
// expand/shrink selection vim style
{
"key": "shift+alt+l",
"command": "editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "shift+alt+h",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
有某種間歇性錯誤,它現在可以按照問題中的說明工作。 如果您需要此功能,這里是完整的配置(今天可以使用),它也會使您感到困惑!
// Place your key bindings in this file to overwrite the defaults
[
// capslock delete
{
"key": "capslock",
"command": "deleteLeft",
"when": "textInputFocus && !editorReadonly"
},
// expand/shrink selection vim style
{
"key": "shift+alt+l",
"command": "editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "shift+alt+h",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
// navigate back forward position
{
"key": "alt+left",
"command": "workbench.action.navigateBack"
},
{
"key": "alt+right",
"command": "workbench.action.navigateForward"
},
// terminal style jump back and forward over words
{
"key": "alt+b",
"command": "cursorWordStartLeft",
"when": "textInputFocus"
},
{
"key": "alt+f",
"command": "cursorWordEndRight",
"when": "textInputFocus"
},
// terminal style delete back and forward over words
{
"key": "alt+capslock",
"command": "deleteWordLeft",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+d",
"command": "deleteWordRight",
"when": "textInputFocus && !editorReadonly"
},
// Lists with vim style shortcuts
{
"key": "alt+j",
"command": "list.focusDown",
"when": "listFocus"
},
{
"key": "alt+k",
"command": "list.focusUp",
"when": "listFocus"
},
// Autosuggest with vim style shortcuts
{
"key": "alt+j",
"command": "selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
{
"key": "alt+k",
"command": "selectPrevSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
// Quick open with vim style shortcuts
{
"key": "alt+j",
"command": "workbench.action.quickOpenSelectNext",
"when": "!editorFocus"
},
{
"key": "alt+k",
"command": "workbench.action.quickOpenSelectPrevious",
"when": "!editorFocus"
},
// Cursor movement with vim style shortcuts
{
"key": "alt+k",
"command": "cursorUp",
"when": "textInputFocus && !suggestWidgetVisible"
},
{
"key": "alt+j",
"command": "cursorDown",
"when": "textInputFocus && !suggestWidgetVisible"
},
{
"key": "alt+h",
"command": "cursorLeft",
"when": "textInputFocus && !suggestWidgetVisible"
},
{
"key": "alt+l",
"command": "cursorRight",
"when": "textInputFocus && !suggestWidgetVisible"
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.