vscode-emacs-mcx icon indicating copy to clipboard operation
vscode-emacs-mcx copied to clipboard

Option to disable conflicting keybindings?

Open gonzojive opened this issue 4 years ago • 2 comments

To ease the transition into this extension, it'd be helpful to have an option to disable all conflicting keybindings.

I'm a longtime emacs user, but I have also been using VS Code for six months and gotten used to some of the keybindings. I noticed the C-d and C-g first.

gonzojive avatar May 17 '20 16:05 gonzojive

Please see https://stackoverflow.com/questions/43184034/remove-a-keyboard-shortcut-from-vs-code . You can disable arbitrary keybindings via user-level keybindings.json.

And you can see the keybindings of this extension here: https://github.com/tuttieee/vscode-emacs-mcx/blob/master/package.json#L92

So, for example, you can disable all commands attached to C-g by this extension by adding the definitions below to your keybindings.json. (Not tested)

[
  {
    "key": "ctrl+g",
    "command": "-emacs-mcx.cancel",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+g",
    "command": "--closeFindWidget",
    "when": "editorFocus && findWidgetVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-closeReferenceSearchEditor",
    "when": "inReferenceSearchEditor && !config.editor.stablePeek"
  },
  {
    "key": "ctrl+g",
    "command": "-closeReferenceSearch",
    "when": "referenceSearchVisible && !config.editor.stablePeek"
  },
  {
    "key": "ctrl+g",
    "command": "-closeBreakpointWidget",
    "when": "breakpointWidgetVisible && editorFocus"
  },
  {
    "key": "ctrl+g",
    "command": "-leaveSnippet",
    "when": "editorTextFocus && inSnippetMode"
  },
  {
    "key": "ctrl+g",
    "command": "-closeMarkersNavigation",
    "when": "editorFocus && markersNavigationVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-closeParameterHints",
    "when": "editorTextFocus && parameterHintsVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-hideSuggestWidget",
    "when": "editorTextFocus && suggestWidgetVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-cancelRenameInput",
    "when": "editorFocus && renameInputVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-closeAccessibilityHelp",
    "when": "accessibilityHelpWidgetVisible && editorFocus"
  },
  {
    "key": "ctrl+g",
    "command": "-closeReplaceInFilesWidget",
    "when": "replaceInputBoxFocus && searchViewletVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-workbench.action.closeMessages",
    "when": "globalMessageVisible"
  },
  {
    "key": "ctrl+g",
    "command": "-workbench.action.closeQuickOpen",
    "when": "inQuickOpen"
  }
]

whitphx avatar May 20 '20 13:05 whitphx

Thanks. I will try that.

I suppose there are a lot of emacs keybindings, so disabling them one by one can be a bit tedious. I am suggesting a checkbox instead, if feasible.

The current documentation is great at mentioning the conflicts, by the way.

gonzojive avatar May 20 '20 16:05 gonzojive