mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-22 04:21:03 +00:00
28 lines
802 B
Lua
28 lines
802 B
Lua
-- lua/plugins/project.lua
|
|
return {
|
|
{
|
|
"ahmedkhalf/project.nvim",
|
|
enabled = false, -- it messes up root folder
|
|
config = function()
|
|
require("project_nvim").setup({
|
|
detection_methods = { "pattern" },
|
|
patterns = {
|
|
".git",
|
|
"Gemfile",
|
|
-- "package.json",
|
|
}, -- Adjust as needed
|
|
sync_root_with_cwd = true, -- Sync `cwd` with project root
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("BufEnter", {
|
|
callback = function()
|
|
local project_root = require("project_nvim.project").get_project_root()
|
|
if project_root and vim.fn.getcwd() ~= project_root then
|
|
print("Changing Project Root:", project_root)
|
|
vim.cmd("cd " .. project_root)
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
}
|