mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-03 09:34:41 +02:00
feat(root): customizable root detection and :LazyRoot
command
This commit is contained in:
parent
e6d294df6f
commit
a2d604928b
6 changed files with 126 additions and 38 deletions
|
@ -104,6 +104,7 @@ function M.setup(opts)
|
|||
end
|
||||
M.load("keymaps")
|
||||
Util.format.setup()
|
||||
Util.root.setup()
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ if vim.lsp.inlay_hint then
|
|||
end
|
||||
|
||||
-- lazygit
|
||||
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root.get(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
map("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||
|
||||
-- quit
|
||||
|
@ -128,7 +128,7 @@ map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
|||
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||
|
||||
-- floating terminal
|
||||
local lazyterm = function() Util.terminal(nil, { cwd = Util.root.get() }) end
|
||||
local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end
|
||||
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||
map("n", "<leader>fT", function() Util.terminal() end, { desc = "Terminal (cwd)" })
|
||||
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
|
||||
|
|
|
@ -5,6 +5,10 @@ vim.g.maplocalleader = "\\"
|
|||
-- Enable LazyVim auto format
|
||||
vim.g.autoformat = true
|
||||
|
||||
-- LazyVim root dir detection
|
||||
-- Each entry can be a detector function like `lsp` or `cwd`, or a pattern like `.git` or `lua`.
|
||||
vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
opt.autowrite = true -- Enable auto write
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue