mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Merge pull request #50 from A-Daneel/master
fix(ui): menusave now gets called on menu toggle
This commit is contained in:
commit
c90596bb71
@ -45,7 +45,7 @@ end
|
|||||||
|
|
||||||
local function merge_tables(...)
|
local function merge_tables(...)
|
||||||
local out = {}
|
local out = {}
|
||||||
for i = 2, select("#",...) do
|
for i = 1, select("#",...) do
|
||||||
merge_table_impl(out, select(i, ...))
|
merge_table_impl(out, select(i, ...))
|
||||||
end
|
end
|
||||||
return out
|
return out
|
||||||
@ -130,7 +130,7 @@ M.setup = function(config)
|
|||||||
|
|
||||||
local complete_config =
|
local complete_config =
|
||||||
merge_tables(
|
merge_tables(
|
||||||
{projects = {}},
|
{projects = {} , global_settings = {["save_on_toggle"] = false}},
|
||||||
expand_dir(c_config),
|
expand_dir(c_config),
|
||||||
expand_dir(u_config),
|
expand_dir(u_config),
|
||||||
expand_dir(config))
|
expand_dir(config))
|
||||||
@ -142,6 +142,10 @@ M.setup = function(config)
|
|||||||
HarpoonConfig = complete_config
|
HarpoonConfig = complete_config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.get_global_settings = function()
|
||||||
|
return HarpoonConfig.global_settings
|
||||||
|
end
|
||||||
|
|
||||||
M.get_term_config = function()
|
M.get_term_config = function()
|
||||||
return ensure_correct_config(HarpoonConfig).projects[vim.loop.cwd()].term
|
return ensure_correct_config(HarpoonConfig).projects[vim.loop.cwd()].term
|
||||||
end
|
end
|
||||||
@ -160,7 +164,7 @@ M.print_config = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Sets a default config with no values
|
-- Sets a default config with no values
|
||||||
M.setup({projects = {}})
|
M.setup()
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
@ -53,6 +53,11 @@ end
|
|||||||
|
|
||||||
M.toggle_quick_menu = function()
|
M.toggle_quick_menu = function()
|
||||||
if win_id ~= nil and vim.api.nvim_win_is_valid(win_id) then
|
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)
|
vim.api.nvim_win_close(win_id, true)
|
||||||
|
|
||||||
win_id = nil
|
win_id = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user