From 2719d549655d1fd1989483ad08b0dd088c7c6f54 Mon Sep 17 00:00:00 2001 From: ThePrimeagen Date: Mon, 22 Feb 2021 09:22:32 -0700 Subject: [PATCH] fix: https://github.com/ThePrimeagen/harpoon/issues/4 --- lua/harpoon/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lua/harpoon/init.lua b/lua/harpoon/init.lua index 4095995..da7d550 100644 --- a/lua/harpoon/init.lua +++ b/lua/harpoon/init.lua @@ -30,6 +30,24 @@ local M = {} --]] harpoon_config = harpoon_config or {} +function ensure_correct_config(config) + local projects = config.projects + if projects[cwd] == nil then + projects[cwd] = { + marks = {}, + term = {}, + } + end + + if projects[cwd].marks == nil then + projects[cwd].marks = {} + end + + if projects[cwd].term == nil then + projects[cwd].term = {} + end +end + function expand_dir(config) local projects = config.projects or {} local expanded_config = {} @@ -83,6 +101,10 @@ M.setup = function(config) expand_dir(u_config), expand_dir(config)) + -- There was this issue where the cwd didn't have marks or term, but had + -- an object for cwd + ensure_correct_config(complete_config) + terminals.setup(complete_config) mark.setup(complete_config) harpoon_config = complete_config