Skip to content

`goto` Without the Menu (Faster?)

losnappas edited this page Jan 7, 2022 · 1 revision

Instead of the menu, using chorded keys seems to improve user experience if you have bindings like g d, because opening the menu is quite often a bit under-performant and then it just takes the d and you delete a character instead, whereas chorded keys don't have that problem.

Note: they're not exactly the vanilla keys (e.g. g j/g k is from vim rather than kakoune), so you'll have to adapt them to your liking. The g f depends on the "Open File" extension, but change to the dance one if you so prefer.

  {
    "key": "g a",
    "text": "previous file",
    "command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g shift+a",
    "text": "previous file",
    "command": "workbench.action.showEditorsInActiveGroup",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g shift+d",
    "text": "go to implementation",
    "command": "dance.run",
    "args": {
      "commands": [
        "editor.action.goToImplementation"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g d",
    "text": "go to definition",
    "command": "dance.run",
    "args": {
      "commands": [
        "editor.action.revealDefinition"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g r",
    "text": "peek references",
    "command": "dance.run",
    "args": {
      "commands": [
        "editor.action.referenceSearch.trigger"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g shift+r",
    "text": "all references",
    "command": "references-view.findReferences",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g h",
    "text": "to line start",
    "command": "dance.select.lineStart.jump",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g l",
    "text": "to line end",
    "command": "dance.run",
    "args": {
      "commands": ["dance.select.lineEnd", "dance.selections.reduce"]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g i",
    "text": "to non-blank line start",
    "command": "dance.run",
    "args": {
      "commands": ["dance.select.lineStart.jump", "cursorHome"]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g g",
    "text": "to first line",
    "command": "dance.run",
    "args": {
      "commands": [
        "cursorTop"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g k",
    "text": "visual line down",
    "command": "cursorUp",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g j",
    "text": "visual line down",
    "command": "cursorDown",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g e",
    "text": "to last char of last line",
    "command": "dance.run",
    "args": {
      "commands": [
        "cursorBottom"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g t",
    "text": "to first displayed line",
    "command": "dance.select.firstVisibleLine.jump",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g c",
    "text": "to middle displayed line",
    "command": "dance.select.middleVisibleLine.jump",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g b",
    "text": "to last displayed line",
    "command": "dance.select.lastVisibleLine.jump",
    "when": "dance.mode == 'normal' && editorTextFocus"
  },
  {
    "key": "g f",
    "text": "to file whose name is selected",
    "command": "dance.run",
    "args": {
      "commands": [
        "seito-openfile.openFileFromText"
      ]
    },
    "when": "dance.mode == 'normal' && editorTextFocus"
  },