otavioschwanck / arrow.nvim

Bookmark your files, separated by project, and quickly navigate through them.
Other
454 stars 19 forks source link

Feature: Toggle betwen recent files #18

Closed HakonHarnes closed 6 months ago

HakonHarnes commented 6 months ago

Description

Arrow.nvim is great for navigating a list of bookmarks, but I often find myself switching back and forth between two recently used files. This requires navigating the full arrow.nvim interface or invoking the next and previous keymaps multiple times.

Proposed solution

Implement a dedicated function to toggle between the currently active file and the previously active file. The function could be called something like require('arrow.persist').toggle_recent.

Example

Mark four files:

  1. file-1
  2. file-2
  3. file-3
  4. file-4

Open file-1, then open file-3. Executing toggle_recent() should switch from file-3 to file-1. Executing toggle_recent() again should switch from file-1 back to file-3.

Note: I love this plugin. It's better than harpoon in my opinion!

otavioschwanck commented 6 months ago

Description

Arrow.nvim is great for navigating a list of bookmarks, but I often find myself switching back and forth between two recently used files. This requires navigating the full arrow.nvim interface or invoking the next and previous keymaps multiple times.

Proposed solution

Implement a dedicated function to toggle between the currently active file and the previously active file. The function could be called something like require('arrow.persist').toggle_recent.

Example

Mark four files:

  1. file-1
  2. file-2
  3. file-3
  4. file-4

Open file-1, then open file-3. Executing toggle_recent() should switch from file-3 to file-1. Executing toggle_recent() again should switch from file-1 back to file-3.

Note: I love this plugin. It's better than harpoon in my opinion!

Awesome idea. Just to check:

The native :b # doesn't works for you for this?

i normally do this:

vim.keymap.set("n", "ge", "<cmd>b#<CR>")
HakonHarnes commented 6 months ago

That'll do it! Didn't realize Vim had a built-in command for this. Thanks.