From eb1dabc44fe9f1cab0bc4cda77f108838cc66156 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 8 Mar 2022 09:33:58 +0100 Subject: [PATCH] nvim: Fix signcolumn jumping When lsp or gitsigns would show me a symbol in the signcolumn the whole editor page would jump ever so slightly to the right (one symbol, to be precise). This fixes it to show numbers in the signcolumn and just exchange number for sign when something should be shown. Makes numbers a little less readable but editing experience a whole lot smoother. --- nvim/.config/nvim/lua/settings.lua | 41 +++++++++++++----------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/nvim/.config/nvim/lua/settings.lua b/nvim/.config/nvim/lua/settings.lua index 253f4c0..31b7ca5 100644 --- a/nvim/.config/nvim/lua/settings.lua +++ b/nvim/.config/nvim/lua/settings.lua @@ -1,19 +1,12 @@ require("helpers.vimoptions") -local default_builtins_disabled = { - "netrw", - "netrwPlugin" -} +local default_builtins_disabled = {"netrw", "netrwPlugin"} local disable_builtins = function(builtins) - for _, plugin in pairs(builtins) do - vim.g["loaded_" .. plugin] = 1 - end + for _, plugin in pairs(builtins) do vim.g["loaded_" .. plugin] = 1 end end local apply_options = function(opts) - for k, v in pairs(opts) do - vim.opt[k] = v - end + for k, v in pairs(opts) do vim.opt[k] = v end end local o = { @@ -37,43 +30,45 @@ local o = { -- shows linenumbers relative to the one you are on, for easy movement and -- dNUMBERd deletions - number = true, - relativenumber = true, + number = true, + relativenumber = true, + -- puts the numbers into the signcolumn so when git/lsp show signs there's no jump + signcolumn = 'number', -- keeps an undofile next to files so that you can even undo if vim is closed -- in between - undofile = true, + undofile = true, -- TODO o.undodir = '~/.cache/nvim/undodir' -- ignores case by default but will use case when search is specifically not -- all lowercased - ignorecase = true, - smartcase = true, + ignorecase = true, + smartcase = true, -- shows previews of what substitute command will do (and a couple others) - inccommand = 'split', + inccommand = 'split', -- disables showing us the current mode in the command line since airline takes -- care of it - showmode = false, + showmode = false, -- turn off modeline, to ensure security observation - modeline = false, + modeline = false, -- i feel foldlevel 2 is generally pretty usable, for headlines and similar - foldlevel = 2, - conceallevel = 2, + foldlevel = 2, + conceallevel = 2, -- enable mouse, doesn't bug me and might come in useful at some point - mouse = 'a', + mouse = 'a', -- pump all clippings into the system clipboard - clipboard='unnamedplus', + clipboard = 'unnamedplus', -- turn of automatic resizing of individual splits equalalways = false, -- make sure there's always *some* context below cursor - scrolloff=4, + scrolloff = 4 }