vscode-vimacs icon indicating copy to clipboard operation
vscode-vimacs copied to clipboard

Vimacs fails to activate in VSCode Remote environment as it cannot detect Vim extension

Open tai opened this issue 4 years ago • 4 comments

Vimacs fails to activate in VSCode Remote environment. Due to this, all Vimacs-defined keybindings fail with an error like "command 'emacs.startRegionMode' not found".

In fact, when I start VSCode Remote session, VSCode shows a error dialog as shown below:

image

I presume this is happening because Vim extension is different from other extensions that require installation to each remote environment - Vim extension only requires local installation, and it is then enabled globally (both local and remote).

Is it possible to remove dependency definition in Vimacs package, so Vimacs can be activated in VSCode Remote environment? Of course it is actually dependent, but it seems having that dependency declared causes it to fail in VSCode Remote environment.

tai avatar Jun 01 '21 05:06 tai

Encountered the same issue today. Would love to use this extension. As mentioned above, work around is remove Vim dependency, or somehow detect that Vim is running locally rather than over remote.

ndjhartman avatar Nov 04 '22 15:11 ndjhartman

Additional workaround to just manually add the keybinds from the extension:

  1. Ctrl-Shift-P to open the command window
  2. Type "Open Keyboard Shortcuts (JSON)"
  3. Paste in the keybinds below (gotten from: https://github.com/migrs/vscode-vimacs/blob/master/package.json)
  4. Full Emacs keybinds in insert mode!

Keybind list

 
// Place your key bindings in this file to override the defaults
[
    { "key": "ctrl+f", "command": "extension.vim_ctrl+f", "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl && vim.mode != 'Insert'" },
    { "key": "ctrl+n", "command": "extension.vim_ctrl+n", "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl && vim.mode != 'Insert'" },
    { "key": "ctrl+w", "command": "extension.vim_ctrl+w", "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl && vim.mode != 'Insert'" },
    { "key": "ctrl+v", "command": "extension.vim_ctrl+v", "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl && vim.mode != 'Insert'" },
    { "key": "ctrl+w", "command": "emacs.action.clipboardCutAction", "when": "editorTextFocus && editorHasSelection && !editorReadonly && vim.mode == 'Insert'" },
    { "key": "ctrl+y", "command": "emacs.action.clipboardPasteAction", "when": "editorTextFocus && !editorReadonly && vim.mode == 'Insert'" },
    { "key": "ctrl+f", "command": "cursorRight", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+f", "command": "cursorRightSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "right", "command": "cursorRight", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "right", "command": "cursorRightSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+b", "command": "cursorLeft", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+b", "command": "cursorLeftSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "left", "command": "cursorLeft", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "left", "command": "cursorLeftSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+p", "command": "cursorUp", "when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+p", "command": "cursorUpSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "up", "command": "cursorUp", "when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "up", "command": "cursorUpSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+n", "command": "cursorDown", "when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+n", "command": "cursorDownSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "down", "command": "cursorDown", "when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "down", "command": "cursorDownSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+right", "command": "cursorWordEndRight", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+right", "command": "cursorWordEndRightSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+left", "command": "cursorWordStartLeft", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+left", "command": "cursorWordStartLeftSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+a", "command": "cursorHome", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+a", "command": "cursorHomeSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+e", "command": "cursorEnd", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+e", "command": "cursorEndSelect", "when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+h", "command": "deleteLeft", "when": "editorTextFocus && vim.mode == 'Insert'" },
    { "key": "ctrl+d", "command": "deleteRight", "when": "editorTextFocus && !editorHasSelection && vim.mode == 'Insert'" },
    { "key": "ctrl+space", "command": "emacs.startRegionMode", "when": "editorFocus && vim.mode == 'Insert'" },
    { "key": "ctrl+k", "command": "emacs.cutAllRight", "when": "editorTextFocus && !inRegionMode && vim.mode == 'Insert'" },
    { "key": "ctrl+g", "command": "cancelSelection", "when": "editorFocus && editorHasSelection" },
    { "key": "ctrl+g", "command": "emacs.exitRegionMode", "when": "inRegionMode" },
    { "key": "ctrl+g", "command": "toggleVim", "when": "editorTextFocus && !inRegionMode && !vim.active" },
    { "key": "ctrl+g", "command": "extension.vim_escape", "when": "editorTextFocus && !inRegionMode && vim.active" },
    { "key": "ctrl+[", "command": "extension.vim_escape", "when": "editorTextFocus && !inRegionMode && vim.active" },
    { "key": "ctrl+p", "command": "showPrevParameterHint", "when": "editorTextFocus && parameterHintsVisible" },
    { "key": "ctrl+n", "command": "showNextParameterHint", "when": "editorTextFocus && parameterHintsVisible" },
    { "key": "ctrl+p", "command": "selectPrevQuickFix", "when": "editorFocus && quickFixWidgetVisible" },
    { "key": "ctrl+n", "command": "selectNextQuickFix", "when": "editorFocus && quickFixWidgetVisible" },
    { "key": "ctrl+p", "command": "selectPrevSuggestion", "when": "editorTextFocus && suggestWidgetVisible" },
    { "key": "ctrl+n", "command": "selectNextSuggestion", "when": "editorTextFocus && suggestWidgetVisible" },
    { "key": "ctrl+p", "command": "workbench.action.quickOpenNavigatePrevious", "when": "inQuickOpen" },
    { "key": "ctrl+n", "command": "workbench.action.quickOpenNavigateNext", "when": "inQuickOpen" },
    { "key": "ctrl+p", "command": "workbench.action.quickOpenNavigatePrevious", "when": "!editorFocus && !inQuickOpen" },
    { "key": "ctrl+n", "command": "workbench.action.quickOpenNavigateNext", "when": "!editorFocus && !inQuickOpen" },
    { "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": "removeSecondaryCursors", "when": "editorHasMultipleSelections && editorTextFocus" },
    { "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": "editorFocus && 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" },
    { "key": "ctrl+n", "command": "", "when": "editorTextFocus && vim.active && vim.mode != 'Insert'" },
    { "key": "ctrl+h", "command": "", "when": "editorTextFocus && vim.active && vim.mode != 'Insert'" },
    { "key": "ctrl+f", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+b", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+a", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+e", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+h", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+d", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+k", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+u", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+w", "command": "", "when": "!editorFocus" },
    { "key": "ctrl+f", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+b", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+n", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+a", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+e", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+h", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+d", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+k", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+w", "command": "", "when": "editorFocus && findWidgetVisible" },
    { "key": "ctrl+f", "command": "cursorRight", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "ctrl+b", "command": "cursorLeft", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "ctrl+p", "command": "cursorUp", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "ctrl+n", "command": "cursorDown", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "ctrl+a", "command": "cursorHome", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "ctrl+e", "command": "cursorEnd", "when": "editorTextFocus && vim.active && vim.mode == 'Replace'" },
    { "key": "alt+w", "command": "emacs.action.clipboardCopyAction" },
    { "key": "alt+f", "command": "cursorWordRight", "when": "editorTextFocus && !inRegionMode" },
    { "key": "alt+f", "command": "cursorWordRightSelect", "when": "editorTextFocus && inRegionMode" },
    { "key": "alt+b", "command": "cursorWordLeft", "when": "editorTextFocus && !inRegionMode" },
    { "key": "alt+b", "command": "cursorWordLeftSelect", "when": "editorTextFocus && inRegionMode" },
    { "key": "alt+d", "command": "deleteWordRight", "when": "editorTextFocus" },
    { "key": "alt+backspace", "command": "deleteWordLeft", "when": "editorTextFocus" },
    { "key": "alt+h", "command": "deleteWordLeft", "when": "editorTextFocus" }
]
 

ndjhartman avatar Nov 04 '22 15:11 ndjhartman

Friendly bump on this. Extension is unusable with Remote SSH currently. Any plans to address? Thanks

ndjhartman avatar Jan 18 '23 19:01 ndjhartman