diff --git a/doc/virt-column.txt b/doc/virt-column.txt index 131fedc..8ba4a3e 100644 --- a/doc/virt-column.txt +++ b/doc/virt-column.txt @@ -2,7 +2,7 @@ Author: Lukas Reineke -Version: 1.5.2 +Version: 1.5.3 ============================================================================== CONTENTS *virt-column.nvim* @@ -88,6 +88,9 @@ virtcolumn *virt-column-virtcolumn* ============================================================================== 4. CHANGELOG *virt-column-changelog* +1.5.3 + * ignore `+N` `-N` columns when |textwidth| is 0 + 1.5.2 * use `default` for |:highlight-link| diff --git a/lua/virt-column/init.lua b/lua/virt-column/init.lua index c7e4707..d610e2d 100644 --- a/lua/virt-column/init.lua +++ b/lua/virt-column/init.lua @@ -56,9 +56,17 @@ M.refresh = function() for i, c in ipairs(colorcolumn) do if vim.startswith(c, "+") then - colorcolumn[i] = textwidth + tonumber(c:sub(2)) + if textwidth ~= 0 then + colorcolumn[i] = textwidth + tonumber(c:sub(2)) + else + colorcolumn[i] = nil + end elseif vim.startswith(c, "-") then - colorcolumn[i] = textwidth - tonumber(c:sub(2)) + if textwidth ~= 0 then + colorcolumn[i] = textwidth - tonumber(c:sub(2)) + else + colorcolumn[i] = nil + end else colorcolumn[i] = tonumber(c) end