VSCodeVim / VSCodeVim/Vim

Some keybindings does not work after exit from insert mode

Open
#8,989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
I create some custom key bindings, these work properly, but when I use insert mode and then exit with <Esc> or <"j" "j"> these key bindings do not work anymore

To Reproduce
I've this custom normalkeybindings:

{
      "before": [
        "<leader>",
        "e"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.view.explorer"
        }
      ]
    },
    {
      "before": [
        "leader",
        "w"
      ],
      "commands": [
        "workbench.action.files.save",
      ]
    }
  1. Close Side Bar
  2. Check when you use <leader> + e works properly and explorer is opened
  3. Press i to use insert mode
  4. Exit from inner mode <Esc>
  5. Now when you use <leader> + e does not work anymore

Same steps with the another key binding

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.
image

Environment (please complete the following information):

  • Extension (VsCodeVim) version: v1.27.2

  • VSCode version: Version: 1.88.0
    Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
    Date: 2024-04-03T13:28:09.495Z
    Electron: 28.2.8
    ElectronBuildId: 27744544
    Chromium: 120.0.6099.291
    Node.js: 18.18.2
    V8: 12.0.267.19-electron.0
    OS: Darwin arm64 23.4.0

  • OS: macOS Sonoma 14.4.1

Additional context
I am using a specific profile inside vscode with vim configuration.
my complete settings.json:

{
  "liveServer.settings.donotVerifyTags": true,
  "workbench.startupEditor": "none",
  "liveServer.settings.donotShowInfoMsg": true,
  "diffEditor.ignoreTrimWhitespace": false,
  "kite.showWelcomeNotificationOnStartup": false,
  "cmake.configureOnOpen": true,
  // Editor
  "editor.formatOnSave": true,
  "editor.fontWeight": "normal",
  "editor.fontLigatures": false,
  "editor.scrollbar.vertical": "hidden",
  "editor.scrollbar.horizontal": "hidden",
  "editor.roundedSelection": false,
  "editor.folding": false,
  "editor.minimap.enabled": false,
  "editor.cursorStyle": "block",
  "editor.glyphMargin": false,
  "editor.tokenColorCustomizations": {
    // "variables": "#a6a28c",
    "comments": "#2ea542",
  },
  "diffEditor.renderSideBySide": false,
  "cmake.debugConfig": {},
  "[python]": {
    "editor.formatOnType": true
  },
  "files.associations": {
    "*.js": "javascript",
    "*.json": "json",
    "*.html": "html"
  },
  "solidity.telemetry": true,
  "gitlens.ai.experimental.provider": "openai",
  "gitlens.ai.experimental.openai.model": "gpt-4-1106-preview",
  // Vim setup
  "vim.enableNeovim": false,
  "vim.neovimPath": "/opt/homebrew/bin/nvim",
  "vim.searchHighlightColor": "rgba(150, 255, 255, 0.3)",
  "vim.leader": "<space>",
  "vim.cursorStylePerMode.insert": "block",
  "vim.easymotion": true,
  "vim.incsearch": true,
  "vim.useSystemClipboard": true,
  "vim.useCtrlKeys": true,
  "vim.hlsearch": true,
  "vim.handleKeys": {
    "<C-a>": false,
    "<C-f>": false
  },
  "vim.insertModeKeyBindings": [
    {
      "before": [
        "j",
        "j"
      ],
      "after": [
        "<Esc>"
      ]
    },
  ],
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": [
        "<leader>",
        "d"
      ],
      "after": [
        "d",
        "d"
      ]
    },
    {
      "before": [
        "<leader>",
        "i"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.terminal.focus"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "u"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.focusActiveEditorGroup"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "p"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.quickOpen"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "o"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.quickOpen"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "v"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.splitEditor"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "h"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.focusFirstEditorGroup"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "l"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.action.focusSecondEditorGroup"
        }
      ]
    },
    {
      "before": [
        "<C-n>"
      ],
      "after": [],
      "commands": [
        {
          "command": ":nohl"
        }
      ]
    },
    {
      "before": [
        "<leader>",
        "e"
      ],
      "after": [],
      "commands": [
        {
          "command": "workbench.view.explorer"
        }
      ]
    },
    {
      "before": [
        "leader",
        "w"
      ],
      "commands": [
        "workbench.action.files.save",
      ]
    }
  ],
  "workbench.sideBar.location": "right",
  "workbench.editor.editorActionsLocation": "hidden",
  "editor.renderWhitespace": "none",
  "vim.statusBarColorControl": true,
  "vim.statusBarColors.normal": [
    "#8FBCBB",
    "#434C5E"
  ],
  "vim.statusBarColors.insert": "#BF616A",
  "vim.statusBarColors.visual": "#B48EAD",
  "vim.statusBarColors.visualline": "#B48EAD",
  "vim.statusBarColors.visualblock": "#A3BE8C",
  "vim.statusBarColors.replace": "#D08770",
  "vim.statusBarColors.commandlineinprogress": "#007ACC",
  "vim.statusBarColors.searchinprogressmode": "#007ACC",
  "vim.statusBarColors.easymotionmode": "#007ACC",
  "vim.statusBarColors.easymotioninputmode": "#007ACC",
  "vim.statusBarColors.surroundinputmode": "#007ACC",
  "workbench.colorCustomizations": {
    "statusBar.noFolderBackground": "#B48EAD",
    "statusBar.debuggingBackground": "#B48EAD",
    "statusBar.foreground": "#434C5E",
    "statusBar.debuggingForeground": "#434C5E",
    "statusBar.background": "#B48EAD"
  },
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the reported vim.insertModeKeyBindings and vim.normalModeKeyBindingsNonRecursive settings, comparing leader mappings before and after exiting insert mode with or jj. Start with the remapping debug logs linked in the issue and trace the keybinding state transition; done means the custom normal-mode commands work again after leaving insert mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.