Git Product home page Git Product logo

vscode-harpoon's Introduction

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: 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.

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

vscode-harpoon's People

Contributors

dane99 avatar harrylavell avatar tobias-z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-harpoon's Issues

feat: support for semantic naming of editors instead of 1,2,3,..

Is your feature request related to a problem? Please describe.
For now one refers to the editors by number.

For semantic reasons it would be nice to refer to them by letters.

This would not clash with mappings if one used go to open the picker and then entered a letter that refers to a saved editor in vsc-harpoon.

The outcome would be similar to vim-ostroga, which is another nice version of harpoon.

Harpoon saves line number

Thanks for bringing this over to vscode

Is your feature request related to a problem? Please describe.
The need to jump between different spots in the same file

Describe the solution you'd like
It would be great if you could save a position in a file, so the same as current but also with the current line number

Describe alternatives you've considered
using vim i and o motion, but the history always gets messed up for me

Additional context
Add any other context or screenshots about the feature request here.

The ability to switch between next and previous buffer would be awesome

Is your feature request related to a problem? Please describe.
It's not a problem, but a pure feature request.

Describe the solution you'd like
I think in theprimeagen's nvim plugin, you can have one command switch between buffers one and two very fast. The same command also switches back to the "current" buffer once you've switched to the "previous" buffer, so that you only need one command for example: "n" to switch between to buffers very fast.

Describe alternatives you've considered
For now I'm using ctrl-6 to do this since I use the vim plugin for vscode and this is the -switch between last buffer command- in vim

Additional context
/

If file already open in editor, switch to that instead of opening new editor

Is your feature request related to a problem? Please describe.
Would love to utilise this for split view - have my harpoon editors open in each split, and use the keyboard shortcuts to switch between them.

Describe the solution you'd like
Press harpoon shortcut ->
If file is not open, open it in current editor
If file is open, switch to that editor

The ability to edit how much of the path that gets displayed in the quick pick selection would be a great convenience in my opinion. currently when I am working with deeply nested files and folders I cannot see the actual file name I am trying to access from the quick pick since the selection bar is not wide enough to display the full path. Could it be set to relative to the current git repo even?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Delete Editor from Editor Quick Pick

Is your feature request related to a problem? Please describe.
I believe the Edit Editors text file can become redundant.

Describe the solution you'd like
Open Editor Quick Pick -> Select Editor -> Hit Delete key -> Harpooned Editor is deleted

Describe alternatives you've considered
Opening the Edit Editors view and deleting the line there. This takes 3 extra steps: deleting the line, saving, and closing the tab.

Edit List Disappears

Describe the bug

Sometimes my edit list appears to disappear. To be fair, this may be user error on my part but I'm not sure where. When it's working and I have a lot of stuff open it all seems to work fine, but when I'm just getting setup, sometimes my list seems to disappear. Maybe if I didn't compulsively hit ctrl+w as often, but I didn't know that would prevent the file from just being reopened if that is the case.

To Reproduce

  1. Alt+A Add item.
  2. Close file or redirect to another file (tried both.)
  3. Alt+E Edit editors (item is there.)
  4. Save/Close Without Changes (tried both.)
  5. Alt+1 GoTo Editor (nothing happens.)
  6. Alt+E Edit editors (empty file.)

Expected behavior

  1. Alt+A Add item.
  2. Close file or redirect to another file.
  3. Alt+E Edit editors (item is there.)
  4. Save/Close Without Changes.
  5. Alt+1 GoTo Editor: Jump to item added earlier.
  6. Alt+E Edit editors (item is still there.)

Desktop (please complete the following information):

  • OS: Windows

Additional context

Sometimes it doesn't disappear? May be linked to having a completely empty workspace with no documents open? I tried with and without using a code workspace. My code directory is located in a drive separate from my user profile folder where my vs code extension settings, etc are. Should my local list appear in my workspace or is it supposed to always be in c:\users<user> somewhere related to the extension location?

Add vscodeHarpoon.harpoon file to .vscode

Is your feature request related to a problem? Please describe.
It is kind of a problem, when you work with git, usually the .gitignore file includes the .vscode folder, so I would consider this folder a better place to locate the vscodeHarpoon.harpoon since by default it will be ignored.

Describe the solution you'd like
Just place the vscodeHarpoon.harpoon file in the .vscode folder

Describe alternatives you've considered
Not sure if it is possible, but the file could be stored outside the project

Additional context
.

Duplicates in edit list

Describe the bug
I accidentally added to the editor list the same file multiple times where I was expecting it to have a single instance of the file in the editor list

To Reproduce
Steps to reproduce the behavior:

  1. Run command Harpoon add editor in the file X
  2. Run the same command in the same file X
  3. Open the editor quick pick and see two copies of the same file X

Expected behavior
To have list with unique elements, even if the files are added several times, it should be only a single instance.

Desktop (please complete the following information):

  • OS: Ubuntu

Requesting dedicated/specific "addEditor[1-9]" in addition to the generalized "addEditor" commands

Hello,
I would like to request an "addEditor[1-9]" command(s), in addition to the general "addEditor".

An example of this in action can be seen in the IdeaVim version of this plugin: HarpoonIJ. It has this functionality and it is great to quickly swap out individual marks. The actual functionality being that it adds the current editor directly to the editor list at the specified index[1-9] as opposed to appending it to the next available index.

Ex. excerpt from my current .ideavimrc file.

" --| Harpoon -------------------------
nmap <leader><C-j> :action SetHarpoon1<cr>
nmap <leader><C-k> :action SetHarpoon2<cr>
nmap <leader><C-l> :action SetHarpoon3<cr>
nmap <leader><C-;> :action SetHarpoon4<cr>

nmap <C-j> :action GotoHarpoon1<cr>
nmap <C-k> :action GotoHarpoon2<cr>
nmap <C-l> :action GotoHarpoon3<cr>
nmap <C-;> :action GotoHarpoon4<cr>

nmap <leader><C-e> :action ShowHarpoon<cr>
nmap <leader><C-a> :action AddToHarpoon<cr>

Mockup of VSCode settings.json with this feature.

    ...
    // --| Harpoon ---------------
    // --| Edit Marks -------
    { "before": ["<leader>", "<C-e>"], "commands": ["vscode-harpoon.editEditors"] },

    // --| Add---------------
    { "before": ["<leader>", "<C-j>"], "commands": ["vscode-harpoon.addEditor1"] },
    { "before": ["<leader>", "<C-k>"], "commands": ["vscode-harpoon.addEditor2"] },
    { "before": ["<leader>", "<C-l>"], "commands": ["vscode-harpoon.addEditor3"] },
    { "before": ["<leader>", "<C-;>"], "commands": ["vscode-harpoon.addEditor4"] },

    // --| Go-To-------------
    { "before": ["<C-j>"], "commands": ["vscode-harpoon.gotoEditor1"] },
    { "before": ["<C-k>"], "commands": ["vscode-harpoon.gotoEditor2"] },
    { "before": ["<C-l>"], "commands": ["vscode-harpoon.gotoEditor3"] },
    { "before": ["<C-;>"], "commands": ["vscode-harpoon.gotoEditor4"] },
    ...

Thank you for your time and consideration,
-id

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.