diff --git a/lua/sidekick/cli/context/location.lua b/lua/sidekick/cli/context/location.lua index 555e6ca2..d7c1f20f 100644 --- a/lua/sidekick/cli/context/location.lua +++ b/lua/sidekick/cli/context/location.lua @@ -1,3 +1,5 @@ +local Config = require("sidekick.config") + local M = {} ---@class sidekick.context.Loc @@ -22,7 +24,7 @@ function M.get(ctx, opts) local name = ctx.name or vim.api.nvim_buf_get_name(ctx.buf) if not name or name == "" then name = "[No Name]" - else + elseif not Config.cli.absolute_paths then local cwd = ctx.cwd or vim.fn.getcwd(0) local ok, rel = pcall(vim.fs.relpath, cwd, name) if ok and rel and rel ~= "" and rel ~= "." then diff --git a/lua/sidekick/config.lua b/lua/sidekick/config.lua index 564617ee..38a49889 100644 --- a/lua/sidekick/config.lua +++ b/lua/sidekick/config.lua @@ -95,6 +95,9 @@ local defaults = { size = 0.5, -- size of the split (0-1 for percentage) }, }, + -- Send absolute file paths to CLI tools instead of paths relative to Neovim's cwd. + -- Useful when the agent runs from a different working directory (e.g. a parent). + absolute_paths = false, --- Actual cli tool config is loaded from the runtime path `sk/cli/{tool}.lua` and merged with the config below. --- For default configs, see https://github.com/folke/sidekick.nvim/tree/main/sk/cli -- stylua: ignore