Skip to content

Commit

Permalink
feat: select navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrimeagen committed Nov 29, 2023
1 parent 5ec7f92 commit 5471588
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/harpoon2/list.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local Listeners = require("harpoon2.listeners")
local Buffer = require("harpoon2.buffer")

local function index_of(items, element, config)
local equals = config and config.equals
Expand Down
6 changes: 6 additions & 0 deletions lua/harpoon2/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ end

function HarpoonUI:select_menu_item()
local idx = vim.fn.line(".")

-- must first save any updates potentially made to the list before
-- navigating
local list = Buffer.get_contents(self.bufnr)
self.active_list:resolve_displayed(list)

self.active_list:select(idx)
self:close_menu()
end
Expand Down

0 comments on commit 5471588

Please sign in to comment.