From d98c514359fc52b956f493abeca5f9d7fb23e5eb Mon Sep 17 00:00:00 2001 From: mpaulson Date: Wed, 29 Nov 2023 07:18:08 -0700 Subject: [PATCH] fix: use save instead of toggle --- lua/harpoon2/buffer.lua | 4 ++-- lua/harpoon2/test/ui_spec.lua | 2 +- lua/harpoon2/ui.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/harpoon2/buffer.lua b/lua/harpoon2/buffer.lua index c6ccc892..bad8558b 100644 --- a/lua/harpoon2/buffer.lua +++ b/lua/harpoon2/buffer.lua @@ -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 lua require('harpoon2').ui:on_menu_save()", + "autocmd BufWriteCmd 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 lua require('harpoon2').ui:on_menu_save()", + "autocmd TextChanged,TextChangedI lua require('harpoon2').ui:save()", bufnr ) ) diff --git a/lua/harpoon2/test/ui_spec.lua b/lua/harpoon2/test/ui_spec.lua index ee95aca7..4051b891 100644 --- a/lua/harpoon2/test/ui_spec.lua +++ b/lua/harpoon2/test/ui_spec.lua @@ -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) diff --git a/lua/harpoon2/ui.lua b/lua/harpoon2/ui.lua index 98cc4260..2f652b8d 100644 --- a/lua/harpoon2/ui.lua +++ b/lua/harpoon2/ui.lua @@ -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