mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
fix(ui): menusave now gets called on menu toggle
Not sure if this is the proper way to solve this. But my moving the son_menu_save call into the closing if-loop it will get properly called on when closing the menu with toggle_quick_menu(). I think merging this change will resolve issue #49.
This commit is contained in:
parent
d6c84aafdf
commit
59bb920a67
@ -46,7 +46,7 @@ end
|
||||
|
||||
local function merge_tables(...)
|
||||
local out = {}
|
||||
for i = 2, select("#",...) do
|
||||
for i = 1, select("#",...) do
|
||||
merge_table_impl(out, select(i, ...))
|
||||
end
|
||||
return out
|
||||
@ -129,7 +129,7 @@ M.setup = function(config)
|
||||
|
||||
local complete_config =
|
||||
merge_tables(
|
||||
{projects = {}},
|
||||
{projects = {} , global_settings = {["save_on_toggle"] = false}},
|
||||
expand_dir(c_config),
|
||||
expand_dir(u_config),
|
||||
expand_dir(config))
|
||||
@ -141,6 +141,10 @@ M.setup = function(config)
|
||||
HarpoonConfig = complete_config
|
||||
end
|
||||
|
||||
M.get_global_settings = function()
|
||||
return HarpoonConfig.global_settings
|
||||
end
|
||||
|
||||
M.get_term_config = function()
|
||||
return HarpoonConfig.projects[cwd].term
|
||||
end
|
||||
@ -155,7 +159,7 @@ M.print_config = function()
|
||||
end
|
||||
|
||||
-- Sets a default config with no values
|
||||
M.setup({projects = {}})
|
||||
M.setup()
|
||||
|
||||
return M
|
||||
|
||||
|
@ -41,6 +41,11 @@ end
|
||||
|
||||
M.toggle_quick_menu = function()
|
||||
if win_id ~= nil and vim.api.nvim_win_is_valid(win_id) then
|
||||
local global_config = harpoon.get_global_settings()
|
||||
print(global_config.save_on_menu_quit)
|
||||
if global_config.save_on_toggle == true then
|
||||
vim.cmd(":lua require('harpoon.ui').on_menu_save()")
|
||||
end
|
||||
vim.api.nvim_win_close(win_id, true)
|
||||
|
||||
win_id = nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user