VSpaceCode / VSpaceCode

Spacemacs like keybindings for Visual Studio Code

Home Page:https://vspacecode.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to override the SPC . (dot) keybinding?

hyperfocus1337 opened this issue · comments

Bug description

I'm able to override commands after SPC by using the following example configuration (SPC `):

{
  "keys": "space.`",
  "name": "Last buffer",
  "icon": "go-to-file",
  "type": "command",
  "commands": [
    "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
    "list.select"
  ]
},

However, I would like to rebind the SPC . sequence like so:

{
  "keys": "space..",
  "name": "Open file browser",
  "icon": "go-to-file",
  "type": "command",
  "command": "file-browser.open"
},

But unfortunately that doesn't work. Is there a different approach I could take?

I also tried "keys": "space+." or "keys": "space.dot", which also don't work.

Expected behavior

I would like to be able to remap SPC . to my example configuration above, how can I achieve this?

Settings

Click to toggle contents of `settings.json`

So far this is the portion of vspacecode.bindingOverrides inside of my settings.json where I'm in the process of imitating my Doom Emacs keybindings.

"vspacecode.bindingOverrides": [
  {
    "keys": "w.-",
    "position": -1
  },
  {
    "keys": "w./",
    "position": -1
  },
  {
    "keys": "b.k",
    "name": "Close active buffer",
    "icon": "close",
    "type": "command",
    "command": "workbench.action.closeActiveEditor"
  },
  {
    "keys": "w.q",
    "name": "Close active window",
    "icon": "close",
    "type": "command",
    "command": "workbench.action.closeEditorsInGroup"
  },
  {
    "keys": "space.`",
    "name": "Last buffer",
    "icon": "go-to-file",
    "type": "command",
    "commands": [
      "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
      "list.select"
    ]
  },
  {
    "keys": "space.dot",
    "name": "Open file browser",
    "icon": "go-to-file",
    "type": "command",
    "command": "file-browser.open",
    "args": "vspacecode.bindings"
  },
  {
    "keys": "g",
    "name": "Git",
    "type": "bindings",
    "bindings": [
      {
        "key": "g",
        "name": "Magit status",
        "type": "command",
        "command": "magit.status"
      },
      {
        "key": "C",
        "name": "Magit clone",
        "type": "command",
        "command": "git.clone"
      }
    ]
  },
  {
    "keys": "t",
    "name": "Toggles",
    "type": "bindings",
    "bindings": [
      {
        "key": "w",
        "name": "Toggle word wrap",
        "type": "command",
        "command": "editor.action.toggleWordWrap"
      }
    ]
  },
  {
    "keys": "o",
    "name": "Open",
    "type": "bindings",
    "bindings": [
      {
        "key": "p",
        "name": "Toggle sidebar",
        "type": "command",
        "command": "workbench.action.toggleSidebarVisibility"
      },
      {
        "key": "t",
        "name": "Open terminal",
        "type": "command",
        "command": "workbench.action.terminal.toggleTerminal"
      },
      {
        "key": "-",
        "name": "Open file browser",
        "type": "command",
        "command": "file-browser.open"
      }
    ]
  },
  {
    "keys": "p",
    "name": "Project",
    "icon": "project",
    "type": "bindings",
    "bindings": [
      {
        "key": "a",
        "name": "Save project",
        "icon": "project",
        "type": "command",
        "command": "projectManager.saveProject"
      },
      {
        "key": "c",
        "name": "Compile project",
        "icon": "gear",
        "type": "command",
        "command": "workbench.action.tasks.build"
      },
      {
        "key": "f",
        "name": "+Find file in project",
        "icon": "file",
        "type": "command",
        "command": "workbench.action.quickOpen"
      },
      {
        "key": "r",
        "name": "Recent projects",
        "icon": "project",
        "type": "command",
        "command": "workbench.action.openRecent"
      },
      {
        "key": "p",
        "name": "List projects",
        "icon": "project",
        "type": "command",
        "command": "projectManager.listProjectsNewWindow"
      },
      {
        "key": "T",
        "name": "Test project",
        "icon": "beaker",
        "type": "command",
        "command": "workbench.action.tasks.test"
      }
    ]
  }
]

For now I resolved it by copying the whole vspacecode.bindings block to my settings.json, while using the following:

{
  "key": ".",
  "name": "Open file browser",
  "icon": "files",
  "type": "command",
  "command": "file-browser.open",
  "args": "vspacecode.bindings"
},

I will close this, and let me know if that doesn't work for you.