Updated config
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ac530dfb97e51d82e3b0a7cddbf7a4a7c4c10ff8" },
|
||||
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "f39f7b6fcd3865ac2146de4cb4045286308f2935" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "5fca7ae4960c415af0b038e89a2d84ef6e16d28d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "e7ea07e42c478cb466cf96124693b447add84011" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
|
||||
|
@ -16,12 +16,24 @@ on({ "BufNewFile", "BufRead" }, {
|
||||
|
||||
on({ "VimEnter" }, {
|
||||
callback = function()
|
||||
-- Change file to its directory if needed
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
|
||||
if vim.fn.isdirectory(file) == 0 then
|
||||
file = vim.fs.dirname(file)
|
||||
end
|
||||
|
||||
-- Switch to root directory of the project
|
||||
local root_patterns = { ".git", "go.mod", "init.lua" }
|
||||
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1])
|
||||
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, {
|
||||
upward = true,
|
||||
path = file,
|
||||
})[1])
|
||||
|
||||
if root_dir then
|
||||
vim.api.nvim_set_current_dir(root_dir)
|
||||
else
|
||||
vim.api.nvim_set_current_dir(file)
|
||||
end
|
||||
|
||||
-- Open file explorer if we have enough space
|
||||
|
@ -10,7 +10,9 @@ local function on_attach(bufnr)
|
||||
|
||||
-- navigation
|
||||
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
|
||||
vim.keymap.set("n", "<C-Enter>", api.tree.change_root_to_node, opts("Enter"))
|
||||
vim.keymap.set("n", "<C-Left>", api.tree.change_root_to_parent, opts("Up"))
|
||||
vim.keymap.set("n", "<C-Down>", api.tree.change_root_to_node, opts("Enter"))
|
||||
vim.keymap.set("n", "<C-Right>", api.tree.change_root_to_node, opts("Enter"))
|
||||
|
||||
-- open folders with a single click
|
||||
vim.keymap.set("n", "<LeftRelease>", function()
|
||||
|
Reference in New Issue
Block a user