From 5c0ab042f970c39b4dff10fb53157cf1c13bc365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20H=C3=A5land?= Date: Tue, 23 Feb 2021 23:34:40 +0100 Subject: [PATCH 1/2] style: remove trailing whitespace --- lua/harpoon/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/harpoon/init.lua b/lua/harpoon/init.lua index 0d2d388..e3c9ec7 100644 --- a/lua/harpoon/init.lua +++ b/lua/harpoon/init.lua @@ -43,7 +43,7 @@ function merge_table_impl(t1, t2) end end -function merge_tables(...) +function merge_tables(...) local out = {} for i = 2, select("#",...) do merge_table_impl(out, select(i, ...)) @@ -51,7 +51,7 @@ function merge_tables(...) return out end -function ensure_correct_config(config) +function ensure_correct_config(config) local projects = config.projects if projects[cwd] == nil then projects[cwd] = { @@ -73,7 +73,7 @@ function ensure_correct_config(config) end end -function expand_dir(config) +function expand_dir(config) local projects = config.projects or {} local expanded_config = {} for k in pairs(projects) do @@ -99,7 +99,7 @@ M.save = function() end -- 1. saved. Where do we save? -M.setup = function(config) +M.setup = function(config) function read_config(config) return vim.fn.json_decode(Path:new(config):read()) end @@ -119,10 +119,10 @@ M.setup = function(config) c_config = {} end - local complete_config = + local complete_config = merge_tables( - {projects = {}}, - expand_dir(c_config), + {projects = {}}, + expand_dir(c_config), expand_dir(u_config), expand_dir(config)) @@ -144,7 +144,7 @@ M.get_mark_config = function() end -- should only be called for debug purposes -M.print_config = function() +M.print_config = function() print(vim.inspect(harpoon_config)) end From b45b04dc57d9cf707879c8c41e9f71d7f869c3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20H=C3=A5land?= Date: Tue, 23 Feb 2021 23:35:26 +0100 Subject: [PATCH 2/2] feat(save): remove dead code to prevent nil value on save `get_config()` is removed and replaced by `get_term_config()` and `get_mark_config()` --- lua/harpoon/init.lua | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lua/harpoon/init.lua b/lua/harpoon/init.lua index e3c9ec7..4bb4387 100644 --- a/lua/harpoon/init.lua +++ b/lua/harpoon/init.lua @@ -85,16 +85,6 @@ function expand_dir(config) end M.save = function() - local term_config = terminals.get_config() - local mark_config = mark.get_config() - - if not harpoon_config.projects[cwd] then - harpoon_config.projects[cwd] = {} - end - - harpoon_config.projects[cwd].term = term_config - harpoon_config.projects[cwd].mark = mark_config - Path:new(cache_config):write(vim.fn.json_encode(harpoon_config), 'w') end