From abe7495ad4615baec11735e933ac32011170dcdb Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Thu, 20 Feb 2025 13:24:55 +0100 Subject: [PATCH] made the split-line function change based on the expandtab and tabstop options in the editor --- init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 247cac1..cd80608 100644 --- a/init.lua +++ b/init.lua @@ -438,8 +438,7 @@ require'lazy'.setup{ --{{{1 } do -- split line {{{1 - -- TODO make this dependant on my tabbin settings - local SPLIT_WHITESPACE = ' ' + local SPLIT_DELIMETERS = { -- single characters only [','] = true, [';'] = true, @@ -456,6 +455,14 @@ do -- split line {{{1 } 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 _, col = unpack(vim.api.nvim_win_get_cursor(0)) col = col + 1 -- Doing this to make it 1-indexed