From 424ad679f861031485e2e2f0ca19f5b559db929b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 17 Sep 2024 00:22:49 +0200 Subject: set signcolumn based on if we are in a git repo or not (might be useful for later) --- lua/config/autocmds.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lua/config/autocmds.lua') 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, +}) -- cgit v1.2.3