Lightweight project navigator with telescope
With lazy.nvim
{
"zongben/proot.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim"
},
opts = {}
}
The default configuration is as follows
{
detector = {
enable_file_detect = true,
enable_lsp_detect = true,
},
files = { ".git" },
ignore = {
lsp = nil, -- ignore lsp clients by name e.g. { "pyright", "tsserver" }
},
events = {
-- called when you change the directory
entered = function(path)
end
},
}
Open proot picker by calling :Proot
In proot picker you can use d
to delete project dir and use r
to rename project name virtually
I like to close all buffers and restart LSP servers after I switched repositories
events = {
entered = function (path)
vim.cmd("bufdo bd")
local clients = vim.lsp.get_clients()
for _, client in pairs(clients) do
vim.cmd("LspRestart " .. client.name)
end
end
}
For users who use toggleterm and lazygit, you can set the directory of lazygit each time you launch it.
This way, each time proot switches to a new directory, lazygit can also switch to the new path accordingly.
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = {
border = "curved",
},
})
function Lazygit_toggle()
lazygit.dir = vim.fn.getcwd()
lazygit:toggle()
end
If you encounter any issues, please check the changelog first.
ahmedkhalf/project.nvim - The superior project management solution for neovim.