summaryrefslogtreecommitdiff
path: root/lua/config
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-09-17 00:22:49 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-09-17 00:22:51 +0200
commit424ad679f861031485e2e2f0ca19f5b559db929b (patch)
tree774881c34a4ea5bbc4398b2085535a74a62ed374 /lua/config
parent5c7dffe3782c18e0d47f5753a8c30a0cd1b6e352 (diff)
set signcolumn based on if we are in a git repo or not (might be useful for later)
Diffstat (limited to 'lua/config')
-rw-r--r--lua/config/autocmds.lua12
-rw-r--r--lua/config/set.lua4
2 files changed, 12 insertions, 4 deletions
diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua
index 247f152..61dc98d 100644
--- a/lua/config/autocmds.lua
+++ b/lua/config/autocmds.lua
@@ -81,3 +81,15 @@ autocmd(
desc = "Enable spell checking for certain file types",
}
)
+
+autocmd({ "BufNewFile", "BufRead" }, {
+ pattern = "*",
+ callback = function()
+ local output = vim.fn.system("git rev-parse --is-inside-work-tree")
+ if output == "true\n" then
+ vim.opt.signcolumn = "yes"
+ else
+ vim.opt.signcolumn = "no"
+ end
+ end,
+})
diff --git a/lua/config/set.lua b/lua/config/set.lua
index 9f328b0..3623a02 100644
--- a/lua/config/set.lua
+++ b/lua/config/set.lua
@@ -36,10 +36,6 @@ opt.directory = home .. "/.local/share/Trash/nvim//,."
opt.ignorecase = true
opt.smartcase = true
--- Keep signcolumn on by default
-print(vim.fs.find(".git", {}))
-opt.signcolumn = "yes"
-
-- Decrease update time
opt.updatetime = 50
opt.timeoutlen = 300