diff --git a/lua/neoconf/config.lua b/lua/neoconf/config.lua index 11d54191..10eabd2e 100644 --- a/lua/neoconf/config.lua +++ b/lua/neoconf/config.lua @@ -2,6 +2,10 @@ local M = {} ---@class Config M.defaults = { + -- Use cwd for neoconf root, prevents searching upwards outside the current project + root_use_cwd = false, + -- on_write callback + on_write = function() end, -- name of the local settings files local_settings = ".neoconf.json", -- name of the global settings file in your Neovim config directory diff --git a/lua/neoconf/workspace.lua b/lua/neoconf/workspace.lua index 662be993..e9bc8356 100644 --- a/lua/neoconf/workspace.lua +++ b/lua/neoconf/workspace.lua @@ -1,3 +1,4 @@ +local Config = require("neoconf.config") local Settings = require("neoconf.settings") local Util = require("neoconf.util") @@ -10,6 +11,9 @@ local M = {} ---@param opts WorkspaceFindOptions function M.find_root(opts) + if Config.options.root_use_cwd then + return tostring(vim.uv.cwd()) + end opts = opts or {} local buf = opts.buffer ~= 0 and opts.buffer or vim.api.nvim_get_current_buf()