Skip to content

A vscode extension inspired by the neovim plugin Harpoon created by The Primeagen

License

Notifications You must be signed in to change notification settings

tobias-z/vscode-harpoon

Repository files navigation

VS Code Harpoon

VS Code Harpoon is inspired by The Primeagen's Harpoon plugin for neovim. It supports the basic use case of file navigation just like with Harpoon.

GitHub License: MIT

Features

VSCode Harpoon is a file navigation tool, which lets you mark editors and jump to your marked editors.

When adding your first editor, it will be set as editor 1, the next editor 2 and so on.

You are then able to jump to editor 1 or editor 2 from anywhere in your workspace.

Navigation Example

Available Commands

  • VSCode Harpoon: Add Editor (vscode-harpoon.addEditor) adds the current editor to your workspace
  • VSCode Harpoon: Add Editor [1-9] (vscode-harpoon.addEditor[1-9]) adds the editor at the specified index
  • VSCode Harpoon: Go to editor [1-9] (vscode-harpoon.gotoEditor[1-9]) Goes to workspace editor [1-9]
  • VSCode Harpoon: Edit Editors (vscode-harpoon.editEditors) Opens an editor for you do delete or move added editors around.
  • VSCode Harpoon: Editor Quick Pick (vscode-harpoon.editorQuickPick) Opens a quick pick menu to pick between your current workspace editors
  • VSCode Harpoon: Go to previous harpoon editor (vscode-harpoon.gotoPreviousHarpoonEditor) Jumps to the previous editor which was last jumped from using harpoon.
  • VSCode Harpoon: Navigate Next Editor (vscode-harpoon.navigateNextEditor) Jumps to the next workspace editor.
  • VSCode Harpoon: Navigate Previous Editor (vscode-harpoon.navigatePreviousEditor) Jumps to the previous workspace editor.
  • VSCode Harpoon: Add Global Editor (vscode-harpoon.addGlobalEditor) adds the current editor globally
  • VSCode Harpoon: Add Global Editor [1-9] (vscode-harpoon.addGlobalEditor[1-9]) adds the editor globally at the specified index
  • VSCode Harpoon: Go to global editor [1-9] (vscode-harpoon.gotoGlobalEditor[1-9]) Goes to global editor [1-9]
  • VSCode Harpoon: Edit Global Editors (vscode-harpoon.editGlobalEditors) Opens an editor for you do delete or move added editors around.
  • VSCode Harpoon: Editor Global Quick Pick (vscode-harpoon.editorGlobalQuickPick) Opens a quick pick menu to pick between your global editors
  • VSCode Harpoon: Go to previous global harpoon editor (vscode-harpoon.gotoPreviousGlobalHarpoonEditor) Jumps to the previous global editor which was last jumped from using harpoon.
  • VSCode Harpoon: Navigate Next Global Editor (vscode-harpoon.navigateGlobalNextEditor) Jumps to the next global workspace editor.
  • VSCode Harpoon: Navigate Previous Global Editor (vscode-harpoon.navigateGlobalPreviousEditor) Jumps to the previous global workspace editor.

Available Contexts

  • VSCode Harpoon: Quick Pick Visible (vscode-harpoon.isQuickPick) Adds context for determining whether harpoon's quick pick list is visible.

Troubleshooting

If desired the extension does support jumping to already open editors in different split panes. However, for this to work you need to add a property to your settings.json:

{
  "workbench.editor.revealIfOpen": true
}

Example Keybinds

VSCode (keybindings.json)

[
  {
    "key": "alt+a",
    "commands": ["vscode-harpoon.addEditor"]
  },
  {
    "key": "alt+e",
    "commands": ["vscode-harpoon.editEditors"]
  },
  {
    "key": "alt+p",
    "commands": ["vscode-harpoon.editorQuickPick"]
  },
  {
    "key": "alt+1",
    "command": "vscode-harpoon.gotoEditor1"
  }
]

VSCode Vim (settings.json)

{
  "vim.leader": " ",
  "vim.normalModeKeyBindings": [
    {
      "before": ["<leader>", "a"],
      "commands": ["vscode-harpoon.addEditor"]
    },
    {
      "before": ["<leader>", "e"],
      "commands": ["vscode-harpoon.editEditors"]
    },
    {
      "before": ["<leader>", "p", "e"],
      "commands": ["vscode-harpoon.editorQuickPick"]
    },
    {
      "before": ["<leader>", "1"],
      "commands": ["vscode-harpoon.gotoEditor1"]
    }
  ]
}

Issues

Looking to contribute? Please read the CONTRIBUTING.md file, which contains information about making a PR.

Any feedback is very appreciated!

🪲 Bugs

Please file an issue for bugs, missing documentation, unexpected behaviour etc.

Create bug report

🕯 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding a 👍.

Create Feature Requests

About

A vscode extension inspired by the neovim plugin Harpoon created by The Primeagen

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published