diff --git a/nvim/plugin/overseer.lua b/nvim/plugin/overseer.lua index 7612807..c5c93e7 100644 --- a/nvim/plugin/overseer.lua +++ b/nvim/plugin/overseer.lua @@ -3,6 +3,8 @@ if vim.g.did_load_overseer_plugin then end vim.g.did_load_overseer_plugin = true +local file_exists = require("user.file_exists").file_exists + require("which-key").add({ { "o", group = "[o]verseer", icon = "" }, { "ot", "OverseerToggle", desc = "[o]verseer: [t]oggle " }, @@ -18,11 +20,15 @@ local root_files = { '.git', } -if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/tasks.json") then - require('overseer').setup({ - strategy = { - "toggleterm", - quit_on_exit = "success", - }, - }) +local root = vim.fs.find(root_files, { upward = true })[1] + +if root then + if file_exists(root .. ".vscode/tasks.json") then + require('overseer').setup({ + strategy = { + "toggleterm", + quit_on_exit = "success", + }, + }) + end end