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

przybylski/cursor-harpoon

 
 

Cursor Harpoon

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

Forked from original work of Tobias Zimmermann

GitHub License: MIT

Features

Cursor 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

Workspace Sessions

Cursor Harpoon supports multiple named sessions within a single workspace. A session captures your list of marked editors.

Available Commands

  • Cursor Harpoon: Add Editor (cursor-harpoon.addEditor) adds the current editor to your workspace
  • Cursor Harpoon: Add Editor [1-9] (cursor-harpoon.addEditor[1-9]) adds the editor at the specified index
  • Cursor Harpoon: Go to editor [1-9] (cursor-harpoon.gotoEditor[1-9]) Goes to workspace editor [1-9]
  • Cursor Harpoon: Edit Editors (cursor-harpoon.editEditors) Opens an editor for you do delete or move added editors around.
  • Cursor Harpoon: Editor Quick Pick (cursor-harpoon.editorQuickPick) Opens a quick pick menu to pick between your current workspace editors
  • Cursor Harpoon: Go to previous harpoon editor (cursor-harpoon.gotoPreviousHarpoonEditor) Jumps to the previous editor which was last jumped from using harpoon.
  • Cursor Harpoon: Navigate Next Editor (cursor-harpoon.navigateNextEditor) Jumps to the next workspace editor.
  • Cursor Harpoon: Navigate Previous Editor (cursor-harpoon.navigatePreviousEditor) Jumps to the previous workspace editor.
  • Cursor Harpoon: Add Global Editor (cursor-harpoon.addGlobalEditor) adds the current editor globally
  • Cursor Harpoon: Add Global Editor [1-9] (cursor-harpoon.addGlobalEditor[1-9]) adds the editor globally at the specified index
  • Cursor Harpoon: Go to global editor [1-9] (cursor-harpoon.gotoGlobalEditor[1-9]) Goes to global editor [1-9]
  • Cursor Harpoon: Edit Global Editors (cursor-harpoon.editGlobalEditors) Opens an editor for you do delete or move added editors around.
  • Cursor Harpoon: Editor Global Quick Pick (cursor-harpoon.editorGlobalQuickPick) Opens a quick pick menu to pick between your global editors
  • Cursor Harpoon: Go to previous global harpoon editor (cursor-harpoon.gotoPreviousGlobalHarpoonEditor) Jumps to the previous global editor which was last jumped from using harpoon.
  • Cursor Harpoon: Navigate Next Global Editor (cursor-harpoon.navigateGlobalNextEditor) Jumps to the next global workspace editor.
  • Cursor Harpoon: Navigate Previous Global Editor (cursor-harpoon.navigateGlobalPreviousEditor) Jumps to the previous global workspace editor.
  • Cursor Harpoon: Delete Editor (cursor-harpoon.deleteEditor) Removes the current editor
  • Cursor Harpoon: Delete Global Editor (cursor-harpoon.deleteGlobalEditor) Removes the current editor globally
  • Cursor Harpoon: Clear All Editors (cursor-harpoon.clearEditors) Removes all editors
  • Cursor Harpoon: Clear All Global Editors (cursor-harpoon.clearGlobalEditors) Removes all editors globally
  • Cursor Harpoon: Session Create (cursor-harpoon.sessionCreate) Create or overwrite a named workspace session with an empty editor list
  • Cursor Harpoon: Session Delete (cursor-harpoon.sessionDelete) Delete a named workspace session
  • Cursor Harpoon: Session Rename (cursor-harpoon.sessionRename) Rename a workspace session
  • Cursor Harpoon: Session Select (cursor-harpoon.sessionSelect) Activate a session for this workspace
  • Cursor Harpoon: Session Quick Pick (cursor-harpoon.sessionQuickPick) Quick pick of sessions (with delete button)

Available Contexts

  • Cursor Harpoon: Quick Pick Visible (cursor-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": ["cursor-harpoon.addEditor"]
    },
    {
        "key": "alt+e",
        "commands": ["cursor-harpoon.editEditors"]
    },
    {
        "key": "alt+p",
        "commands": ["cursor-harpoon.editorQuickPick"]
    },
    {
        "key": "alt+1",
        "command": "cursor-harpoon.gotoEditor1"
    }
]

VSCode Vim (settings.json)

{
    "vim.leader": " ",
    "vim.normalModeKeyBindings": [
        {
            "before": ["<leader>", "a"],
            "commands": ["cursor-harpoon.addEditor"]
        },
        {
            "before": ["<leader>", "e"],
            "commands": ["cursor-harpoon.editEditors"]
        },
        {
            "before": ["<leader>", "p", "e"],
            "commands": ["cursor-harpoon.editorQuickPick"]
        },
        {
            "before": ["<leader>", "1"],
            "commands": ["cursor-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

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • TypeScript 94.3%
  • JavaScript 5.6%
  • Shell 0.1%