Updated config

This commit is contained in:
Eduard Urbach 2024-01-22 15:04:33 +01:00
parent 1468aaccb8
commit 86ffacb1e7
Signed by: eduard
GPG key ID: 49226B848C78F6C8
12 changed files with 138 additions and 13 deletions

View file

@ -13,3 +13,23 @@ on({ "BufNewFile", "BufRead" }, {
vim.opt_local.signcolumn = "no"
end,
})
on({ "VimEnter" }, {
callback = function()
-- 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])
if root_dir then
vim.api.nvim_set_current_dir(root_dir)
end
-- Open file explorer if we have enough space
local files = require("nvim-tree.api")
local width = vim.go.columns
if width > 120 then
files.tree.toggle({ focus = false })
end
end,
})