made the split-line function change based on the expandtab and tabstop options in the editor

This commit is contained in:
Ivar Fatland
2025-02-20 13:24:55 +01:00
parent 7824eedf10
commit abe7495ad4
+9 -2
View File
@@ -438,8 +438,7 @@ require'lazy'.setup{ --{{{1
} }
do -- split line {{{1 do -- split line {{{1
-- TODO make this dependant on my tabbin settings
local SPLIT_WHITESPACE = ' '
local SPLIT_DELIMETERS = { -- single characters only local SPLIT_DELIMETERS = { -- single characters only
[','] = true, [','] = true,
[';'] = true, [';'] = true,
@@ -456,6 +455,14 @@ do -- split line {{{1
} }
local split_line = function() local split_line = function()
local SPLIT_WHITESPACE = ' '
if vim.o.expandtab then
SPLIT_WHITESPACE = ''
for _ = 1, vim.o.tabstop do
SPLIT_WHITESPACE = SPLIT_WHITESPACE .. ' '
end
end
local line = vim.api.nvim_get_current_line() local line = vim.api.nvim_get_current_line()
local _, col = unpack(vim.api.nvim_win_get_cursor(0)) local _, col = unpack(vim.api.nvim_win_get_cursor(0))
col = col + 1 -- Doing this to make it 1-indexed col = col + 1 -- Doing this to make it 1-indexed