fix: use save instead of toggle

This commit is contained in:
mpaulson 2023-11-29 07:18:08 -07:00
parent b6800cb0ed
commit d98c514359
3 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
-- TODO: Update these to use the new autocmd api
vim.cmd(
string.format(
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon2').ui:on_menu_save()",
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon2').ui:save()",
bufnr
)
)
@ -77,7 +77,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
if global_config.save_on_change then
vim.cmd(
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
)
)

View File

@ -35,7 +35,7 @@ describe("harpoon", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
table.remove(created_files, 2)
Buffer.set_contents(harpoon.ui.bufnr, created_files)
harpoon.ui:toggle_quick_menu()
harpoon.ui:save()
eq(harpoon:list():length(), 2)
eq(harpoon:list():display(), created_files)

View File

@ -106,7 +106,7 @@ function HarpoonUI:select_menu_item()
self:close_menu()
end
function HarpoonUI:on_menu_save()
function HarpoonUI:save()
local list = Buffer.get_contents(self.bufnr)
self.active_list:resolve_displayed(list)
end