mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 10:00:29 +00:00
fix: use save instead of toggle
This commit is contained in:
parent
b6800cb0ed
commit
d98c514359
@ -67,7 +67,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
|
|||||||
-- TODO: Update these to use the new autocmd api
|
-- TODO: Update these to use the new autocmd api
|
||||||
vim.cmd(
|
vim.cmd(
|
||||||
string.format(
|
string.format(
|
||||||
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon2').ui:on_menu_save()",
|
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon2').ui:save()",
|
||||||
bufnr
|
bufnr
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -77,7 +77,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
|
|||||||
if global_config.save_on_change then
|
if global_config.save_on_change then
|
||||||
vim.cmd(
|
vim.cmd(
|
||||||
string.format(
|
string.format(
|
||||||
"autocmd TextChanged,TextChangedI <buffer=%s> lua require('harpoon2').ui:on_menu_save()",
|
"autocmd TextChanged,TextChangedI <buffer=%s> lua require('harpoon2').ui:save()",
|
||||||
bufnr
|
bufnr
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -35,7 +35,7 @@ describe("harpoon", function()
|
|||||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
table.remove(created_files, 2)
|
table.remove(created_files, 2)
|
||||||
Buffer.set_contents(harpoon.ui.bufnr, created_files)
|
Buffer.set_contents(harpoon.ui.bufnr, created_files)
|
||||||
harpoon.ui:toggle_quick_menu()
|
harpoon.ui:save()
|
||||||
|
|
||||||
eq(harpoon:list():length(), 2)
|
eq(harpoon:list():length(), 2)
|
||||||
eq(harpoon:list():display(), created_files)
|
eq(harpoon:list():display(), created_files)
|
||||||
|
@ -106,7 +106,7 @@ function HarpoonUI:select_menu_item()
|
|||||||
self:close_menu()
|
self:close_menu()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HarpoonUI:on_menu_save()
|
function HarpoonUI:save()
|
||||||
local list = Buffer.get_contents(self.bufnr)
|
local list = Buffer.get_contents(self.bufnr)
|
||||||
self.active_list:resolve_displayed(list)
|
self.active_list:resolve_displayed(list)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user