use single quotes

This commit is contained in:
2025-07-29 19:29:57 +02:00
parent b28b49d6fe
commit e67b9ff3e6
+112 -108
View File
@@ -1,4 +1,3 @@
---@diagnostic disable: missing-fields
-- vim:foldmethod=marker -- vim:foldmethod=marker
local function get_python_venv_path() --{{{1 local function get_python_venv_path() --{{{1
@@ -72,7 +71,7 @@ vim.api.nvim_create_autocmd({
end end
}) })
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd('BufEnter', {
callback = function() callback = function()
local line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1] local line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]
if line then if line then
@@ -85,14 +84,14 @@ vim.api.nvim_create_autocmd("BufEnter", {
}) })
-- LAZY.NVIM BOOTSTRAP {{{1 -- LAZY.NVIM BOOTSTRAP {{{1
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", 'git',
"clone", 'clone',
"--filter=blob:none", '--filter=blob:none',
"https://github.com/folke/lazy.nvim.git", 'https://github.com/folke/lazy.nvim.git',
"--branch=stable", -- latest stable release '--branch=stable', -- latest stable release
lazypath, lazypath,
}) })
end end
@@ -103,30 +102,30 @@ require'lazy'.setup{ --{{{1
---@module 'oil' ---@module 'oil'
---@type oil.SetupOpts ---@type oil.SetupOpts
opts = {}, opts = {},
dependencies = { { "echasnovski/mini.icons", opts = {} } }, dependencies = { { 'echasnovski/mini.icons', opts = {} } },
lazy = false, lazy = false,
config = function () config = function ()
require("oil").setup({ require('oil').setup({
default_file_explorer = true, default_file_explorer = true,
columns = { columns = {
"icon", 'icon',
"permissions", 'permissions',
"size", 'size',
"mtime", 'mtime',
}, },
buf_options = { buf_options = {
buflisted = false, buflisted = false,
bufhidden = "hide", bufhidden = 'hide',
}, },
win_options = { win_options = {
wrap = false, wrap = false,
signcolumn = "no", signcolumn = 'no',
cursorcolumn = false, cursorcolumn = false,
foldcolumn = "0", foldcolumn = '0',
spell = false, spell = false,
list = false, list = false,
conceallevel = 3, conceallevel = 3,
concealcursor = "nvic", concealcursor = 'nvic',
}, },
delete_to_trash = false, delete_to_trash = false,
skip_confirm_for_simple_edits = false, skip_confirm_for_simple_edits = false,
@@ -137,42 +136,42 @@ require'lazy'.setup{ --{{{1
timeout_ms = 1000, timeout_ms = 1000,
autosave_changes = false, autosave_changes = false,
}, },
constrain_cursor = "editable", constrain_cursor = 'editable',
watch_for_changes = false, watch_for_changes = false,
keymaps = { keymaps = {
["g?"] = { "actions.show_help", mode = "n" }, ['g?'] = { 'actions.show_help', mode = 'n' },
["<CR>"] = "actions.select", ['<CR>'] = 'actions.select',
["<C-j>"] = "actions.select", ['<C-j>'] = 'actions.select',
["<C-s>"] = { "actions.select", opts = { vertical = true } }, ['<C-s>'] = { 'actions.select', opts = { vertical = true } },
["<C-h>"] = { "actions.select", opts = { horizontal = true } }, ['<C-h>'] = { 'actions.select', opts = { horizontal = true } },
["<C-t>"] = { "actions.select", opts = { tab = true } }, ['<C-t>'] = { 'actions.select', opts = { tab = true } },
["<C-p>"] = "actions.preview", ['<C-p>'] = 'actions.preview',
["<C-c>"] = { "actions.close", mode = "n" }, ['<C-c>'] = { 'actions.close', mode = 'n' },
["<C-l>"] = "actions.refresh", ['<C-l>'] = 'actions.refresh',
["-"] = { "actions.parent", mode = "n" }, ['-'] = { 'actions.parent', mode = 'n' },
["_"] = { "actions.open_cwd", mode = "n" }, ['_'] = { 'actions.open_cwd', mode = 'n' },
["`"] = { "actions.cd", mode = "n" }, ['`'] = { 'actions.cd', mode = 'n' },
["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" }, ['~'] = { 'actions.cd', opts = { scope = 'tab' }, mode = 'n' },
["gs"] = { "actions.change_sort", mode = "n" }, ['gs'] = { 'actions.change_sort', mode = 'n' },
["gx"] = "actions.open_external", ['gx'] = 'actions.open_external',
["g."] = { "actions.toggle_hidden", mode = "n" }, ['g.'] = { 'actions.toggle_hidden', mode = 'n' },
["g\\"] = { "actions.toggle_trash", mode = "n" }, ['g\\'] = { 'actions.toggle_trash', mode = 'n' },
}, },
use_default_keymaps = true, use_default_keymaps = true,
view_options = { view_options = {
show_hidden = true, show_hidden = true,
is_hidden_file = function(name, _) is_hidden_file = function(name, _)
local m = name:match("^%.") local m = name:match('^%.')
return m ~= nil return m ~= nil
end, end,
is_always_hidden = function(_, _) is_always_hidden = function(_, _)
return false return false
end, end,
natural_order = "fast", natural_order = 'fast',
case_insensitive = false, case_insensitive = false,
sort = { sort = {
{ "type", "asc" }, { 'type', 'asc' },
{ "name", "asc" }, { 'name', 'asc' },
}, },
highlight_filename = function(_, _, _, _) highlight_filename = function(_, _, _, _)
return nil return nil
@@ -183,19 +182,19 @@ require'lazy'.setup{ --{{{1
padding = 2, padding = 2,
max_width = 0, max_width = 0,
max_height = 0, max_height = 0,
border = "rounded", border = 'rounded',
win_options = { win_options = {
winblend = 0, winblend = 0,
}, },
get_win_title = nil, get_win_title = nil,
preview_split = "auto", preview_split = 'auto',
override = function(conf) override = function(conf)
return conf return conf
end, end,
}, },
preview_win = { preview_win = {
update_on_cursor_moved = true, update_on_cursor_moved = true,
preview_method = "fast_scratch", preview_method = 'fast_scratch',
disable_preview = function(_) disable_preview = function(_)
return false return false
end, end,
@@ -208,7 +207,7 @@ require'lazy'.setup{ --{{{1
max_height = 0.9, max_height = 0.9,
min_height = { 5, 0.1 }, min_height = { 5, 0.1 },
height = nil, height = nil,
border = "rounded", border = 'rounded',
win_options = { win_options = {
winblend = 0, winblend = 0,
}, },
@@ -220,33 +219,33 @@ require'lazy'.setup{ --{{{1
max_height = { 10, 0.9 }, max_height = { 10, 0.9 },
min_height = { 5, 0.1 }, min_height = { 5, 0.1 },
height = nil, height = nil,
border = "rounded", border = 'rounded',
minimized_border = "none", minimized_border = 'none',
win_options = { win_options = {
winblend = 0, winblend = 0,
}, },
}, },
ssh = { ssh = {
border = "rounded", border = 'rounded',
}, },
keymaps_help = { keymaps_help = {
border = "rounded", border = 'rounded',
}, },
}) })
-- oil fix relative path -- oil fix relative path
vim.api.nvim_create_augroup('OilRelPathFix', {}) vim.api.nvim_create_augroup('OilRelPathFix', {})
vim.api.nvim_create_autocmd("BufLeave", { vim.api.nvim_create_autocmd('BufLeave', {
group = 'OilRelPathFix', group = 'OilRelPathFix',
pattern = "oil:///*", pattern = 'oil:///*',
callback = function () callback = function ()
vim.cmd("cd .") vim.cmd('cd .')
end end
}) })
local actions = require("oil.actions") local actions = require('oil.actions')
vim.keymap.set("n", "-", actions.parent.callback, { desc = actions.parent.desc }) vim.keymap.set('n', '-', actions.parent.callback, { desc = actions.parent.desc })
vim.keymap.set("n", "_", actions.open_cwd.callback, { desc = actions.open_cwd.desc }) vim.keymap.set('n', '_', actions.open_cwd.callback, { desc = actions.open_cwd.desc })
end end
}, },
{ 'github/copilot.vim', --{{{2 { 'github/copilot.vim', --{{{2
@@ -327,12 +326,12 @@ require'lazy'.setup{ --{{{1
require'cronex'.setup{ require'cronex'.setup{
-- The plugin will automatically start (with autocommand) for these types of files. -- The plugin will automatically start (with autocommand) for these types of files.
-- User can manually on any filetype turn explanations on(off) with the commands CronExplainedEnable(CronExplainedDisable) -- User can manually on any filetype turn explanations on(off) with the commands CronExplainedEnable(CronExplainedDisable)
file_patterns = { "*.lua", "*.py", "*.c", "*.cpp", "*.hpp", "*.cs", "*.java", "*.go", "*.zig", "*.rust", "*.bash", "*.sh", "*.yaml", "*.yml", "*.json", "*.toml", }, file_patterns = { '*.lua', '*.py', '*.c', '*.cpp', '*.hpp', '*.cs', '*.java', '*.go', '*.zig', '*.rust', '*.bash', '*.sh', '*.yaml', '*.yml', '*.json', '*.toml', },
extractor = { -- Configuration on how to extract cron expressions goes here: extractor = { -- Configuration on how to extract cron expressions goes here:
-- cron_from_line: Function to search cron expression in line -- cron_from_line: Function to search cron expression in line
cron_from_line = require("cronex.cron_from_line").cron_from_line, cron_from_line = require('cronex.cron_from_line').cron_from_line,
-- extract: Function returning a table with pairs (line_number, cron) -- extract: Function returning a table with pairs (line_number, cron)
extract = require("cronex.extract").extract, extract = require('cronex.extract').extract,
}, },
explainer = { -- Configuration on how to explain one cron expression goes here explainer = { -- Configuration on how to explain one cron expression goes here
-- Command to call an external program that will translate the cron expression -- Command to call an external program that will translate the cron expression
@@ -341,7 +340,7 @@ require'lazy'.setup{ --{{{1
-- examples: -- examples:
-- "/path/to/miniconda3/envs/neovim/bin/cronstrue" (point to a conda virtualenv) -- "/path/to/miniconda3/envs/neovim/bin/cronstrue" (point to a conda virtualenv)
-- "python explainer.py" (assuming you have such a python script available) -- "python explainer.py" (assuming you have such a python script available)
cmd = "cronstrue", -- or a table, eg: cmd = {"bash", "./my-cron-script.sh"} cmd = 'cronstrue', -- or a table, eg: cmd = {"bash", "./my-cron-script.sh"}
-- Optional arguments to pass to the command -- Optional arguments to pass to the command
-- eg: "/path/to/a/go/binary" (assuming you have a go binary) -- eg: "/path/to/a/go/binary" (assuming you have a go binary)
-- args = { "-print-all" } (assuming the program understands the flag 'print-all') -- args = { "-print-all" } (assuming the program understands the flag 'print-all')
@@ -360,22 +359,22 @@ require'lazy'.setup{ --{{{1
end, end,
}, },
{ 'roodletoof/zen-mode.nvim', --{{{2 { 'roodletoof/zen-mode.nvim', --{{{2
keys = {",z"}, keys = {',z'},
config = function () config = function ()
local zen_mode = require'zen-mode' local zen_mode = require'zen-mode'
zen_mode.setup{} zen_mode.setup{}
vim.keymap.set( vim.keymap.set(
'n', 'n',
",z", ',z',
function() function()
zen_mode.toggle{ zen_mode.toggle{
window = { window = {
width = 80, width = 80,
options = { options = {
signcolumn = "no", signcolumn = 'no',
cursorline = false, cursorline = false,
cursorcolumn = false, cursorcolumn = false,
foldcolumn = "0", foldcolumn = '0',
list = false, list = false,
} }
}, },
@@ -393,19 +392,20 @@ require'lazy'.setup{ --{{{1
}, },
ft = {'cs', 'razor'}, ft = {'cs', 'razor'},
config = function() config = function()
local mason_registry = require("mason-registry") local _ = require('mason-registry') -- TODO, do I even need this line?
local rzls_path = vim.fn.expand("$MASON/packages/rzls/libexec") local rzls_path = vim.fn.expand('$MASON/packages/rzls/libexec')
local cmd = { local cmd = {
"roslyn", 'roslyn',
"--stdio", '--stdio',
"--logLevel=Information", '--logLevel=Information',
"--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), '--extensionLogDirectory=' .. vim.fs.dirname(vim.lsp.get_log_path()),
"--razorSourceGenerator=" .. vim.fs.joinpath(rzls_path, "Microsoft.CodeAnalysis.Razor.Compiler.dll"), '--razorSourceGenerator=' .. vim.fs.joinpath(rzls_path, 'Microsoft.CodeAnalysis.Razor.Compiler.dll'),
"--razorDesignTimePath=" .. vim.fs.joinpath(rzls_path, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets"), '--razorDesignTimePath=' .. vim.fs.joinpath(rzls_path, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets'),
"--extension", '--extension',
vim.fs.joinpath(rzls_path, "RazorExtension", "Microsoft.VisualStudioCode.RazorExtension.dll"), vim.fs.joinpath(rzls_path, 'RazorExtension', 'Microsoft.VisualStudioCode.RazorExtension.dll'),
} }
require'rzls'.setup{} ---@diagnostic disable-next-line: missing-fields
require'rzls'.setup{} -- the missing-fields waring is bullshit. the fields are actually optional
require'roslyn'.setup{ require'roslyn'.setup{
cmd = cmd, cmd = cmd,
config = { config = {
@@ -425,12 +425,12 @@ require'lazy'.setup{ --{{{1
} }
end, end,
}, },
{ "folke/lazydev.nvim", --{{{2 { 'folke/lazydev.nvim', --{{{2
ft = "lua", -- only load on lua files ft = 'lua', -- only load on lua files
opts = { opts = {
library = { library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } }, { path = '${3rd}/luv/library', words = { 'vim%.uv' } },
{ path = "${3rd}/love2d/library", words = { "love" } }, { path = '${3rd}/love2d/library', words = { 'love' } },
}, },
}, },
}, },
@@ -455,7 +455,7 @@ require'lazy'.setup{ --{{{1
} }
vim.lsp.config.lua_ls = { vim.lsp.config.lua_ls = {
settings = { settings = {
Lua = { runtime = { version = "LuaJIT" } } Lua = { runtime = { version = 'LuaJIT' } }
} }
} }
vim.lsp.config.gopls = { vim.lsp.config.gopls = {
@@ -479,15 +479,15 @@ require'lazy'.setup{ --{{{1
}) })
vim.lsp.enable('hls') vim.lsp.enable('hls')
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args) callback = function(args)
vim.bo[args.buf].tagfunc = nil vim.bo[args.buf].tagfunc = nil
end, end,
}) })
local function jump_to_definition() local function jump_to_definition()
local word = vim.fn.expand("<cword>") local word = vim.fn.expand('<cword>')
vim.cmd("tag " .. word) vim.cmd('tag ' .. word)
end end
vim.keymap.set( 'n', ',fc', jump_to_definition, { noremap = true, silent = true}) vim.keymap.set( 'n', ',fc', jump_to_definition, { noremap = true, silent = true})
@@ -500,16 +500,20 @@ require'lazy'.setup{ --{{{1
noremap ,ca :lua vim.lsp.buf.code_action()<CR> noremap ,ca :lua vim.lsp.buf.code_action()<CR>
noremap ,oe :lua vim.diagnostic.open_float()<CR> noremap ,oe :lua vim.diagnostic.open_float()<CR>
noremap ,ea :lua vim.diagnostic.setqflist()<CR> noremap ,ea :lua vim.diagnostic.setqflist()<CR>
noremap ,ee :lua vim.diagnostic.setqflist{severity="ERROR"}<CR> noremap ,ee :lua vim.diagnostic.setqflist{severity='ERROR'}<CR>
noremap ,ew :lua vim.diagnostic.setqflist{severity="WARN"}<CR> noremap ,ew :lua vim.diagnostic.setqflist{severity='WARN'}<CR>
noremap ,ei :lua vim.diagnostic.setqflist{severity="INFO"}<CR> noremap ,ei :lua vim.diagnostic.setqflist{severity='INFO'}<CR>
noremap ,eh :lua vim.diagnostic.setqflist{severity="HINT"}<CR> noremap ,eh :lua vim.diagnostic.setqflist{severity='HINT'}<CR>
]] ]]
end end
}, },
{ 'nvim-treesitter/nvim-treesitter', --{{{2 { 'nvim-treesitter/nvim-treesitter', --{{{2
config = function() config = function()
require'nvim-treesitter.configs'.setup{ require'nvim-treesitter.configs'.setup{
modules = {},
ensure_installed = {},
ignore_install = {},
parser_install_dir = nil,
sync_install = false, sync_install = false,
auto_install = true, auto_install = true,
indent = { indent = {
@@ -522,11 +526,11 @@ require'lazy'.setup{ --{{{1
} }
end, end,
}, },
{ "kdheepak/lazygit.nvim", --{{{2 { 'kdheepak/lazygit.nvim', --{{{2
lazy = true, lazy = true,
cmd = { "LazyGit", "LazyGitConfig", "LazyGitCurrentFile", "LazyGitFilter", "LazyGitFilterCurrentFile", }, cmd = { 'LazyGit', 'LazyGitConfig', 'LazyGitCurrentFile', 'LazyGitFilter', 'LazyGitFilterCurrentFile', },
dependencies = { "nvim-lua/plenary.nvim", }, dependencies = { 'nvim-lua/plenary.nvim', },
keys = { { ",g", "<cmd>LazyGit<cr>", desc = "LazyGit" }, }, keys = { { ',g', '<cmd>LazyGit<cr>', desc = 'LazyGit' }, },
}, },
{ 'mfussenegger/nvim-dap', --{{{2 { 'mfussenegger/nvim-dap', --{{{2
dependencies = { dependencies = {
@@ -543,7 +547,7 @@ require'lazy'.setup{ --{{{1
local dap = require'dap' local dap = require'dap'
dap.adapters.godot = { type = 'server', host = '127.0.0.1', port = 6006, } dap.adapters.godot = { type = 'server', host = '127.0.0.1', port = 6006, }
dap.configurations.gdscript = { {type = 'godot', request = 'launch', name = 'Launch scene', project = "${workspaceFolder}",} } dap.configurations.gdscript = { {type = 'godot', request = 'launch', name = 'Launch scene', project = '${workspaceFolder}',} }
dap.adapters.lldb = { dap.adapters.lldb = {
type = 'executable', type = 'executable',
@@ -595,7 +599,7 @@ require'lazy'.setup{ --{{{1
]] ]]
local function file_exists(name) local function file_exists(name)
local f = io.open(name,"r") local f = io.open(name,'r')
if f~=nil then if f~=nil then
f:close() f:close()
return true return true
@@ -615,7 +619,7 @@ require'lazy'.setup{ --{{{1
assert( assert(
file ~= nil, file ~= nil,
("io.open('%s', 'w') returned nil.\n"):format(snippets_path) .. ("io.open('%s', 'w') returned nil.\n"):format(snippets_path) ..
"Make sure the snippets folder in the above path exists." 'Make sure the snippets folder in the above path exists.'
) )
file:close() file:close()
print('created file: ', snippets_path) print('created file: ', snippets_path)
@@ -672,8 +676,8 @@ require'lazy'.setup{ --{{{1
defaults = { defaults = {
file_ignore_patterns = {'%__virtual.cs$'}, file_ignore_patterns = {'%__virtual.cs$'},
mappings = { mappings = {
i = { ["<C-Q>"] = a.smart_send_to_qflist + a.open_qflist, ["<C-j>"] = a.select_default, }, i = { ['<C-Q>'] = a.smart_send_to_qflist + a.open_qflist, ['<C-j>'] = a.select_default, },
n = { ["<C-Q>"] = a.smart_send_to_qflist + a.open_qflist, ["<C-j>"] = a.select_default, }, n = { ['<C-Q>'] = a.smart_send_to_qflist + a.open_qflist, ['<C-j>'] = a.select_default, },
} }
}, },
extensions = { ['ui-select'] = { require'telescope.themes'.get_dropdown{}, }, }, extensions = { ['ui-select'] = { require'telescope.themes'.get_dropdown{}, }, },
@@ -690,10 +694,10 @@ require'lazy'.setup{ --{{{1
noremap ,fb :lua require'telescope.builtin'.buffers()<CR> noremap ,fb :lua require'telescope.builtin'.buffers()<CR>
noremap ,fea :lua require'telescope.builtin'.diagnostics()<CR> noremap ,fea :lua require'telescope.builtin'.diagnostics()<CR>
noremap ,fee :lua require'telescope.builtin'.diagnostics{severity="ERROR"}<CR> noremap ,fee :lua require'telescope.builtin'.diagnostics{severity='ERROR'}<CR>
noremap ,few :lua require'telescope.builtin'.diagnostics{severity="WARN"}<CR> noremap ,few :lua require'telescope.builtin'.diagnostics{severity='WARN'}<CR>
noremap ,fei :lua require'telescope.builtin'.diagnostics{severity="INFO"}<CR> noremap ,fei :lua require'telescope.builtin'.diagnostics{severity='INFO'}<CR>
noremap ,feh :lua require'telescope.builtin'.diagnostics{severity="HINT"}<CR> noremap ,feh :lua require'telescope.builtin'.diagnostics{severity='HINT'}<CR>
]] ]]
require'telescope'.load_extension'ui-select' require'telescope'.load_extension'ui-select'
@@ -796,25 +800,25 @@ do -- split line {{{1
end end
if not last_bracket_i then if not last_bracket_i then
print("The first opening bracket found after the cursor was not closed on this line.") print('The first opening bracket found after the cursor was not closed on this line.')
return return
end end
---@type string ---@type string
local leading_whitespace = string.match(line, "^%s*") local leading_whitespace = string.match(line, '^%s*')
local first_line = line:sub(1, first_bracket_i) local first_line = line:sub(1, first_bracket_i)
local last_line = leading_whitespace .. line:sub(last_bracket_i, #line) local last_line = leading_whitespace .. line:sub(last_bracket_i, #line)
if #split_indexes == 0 then if #split_indexes == 0 then
if (last_bracket_i - first_bracket_i == 1) then return end if (last_bracket_i - first_bracket_i == 1) then return end
local row, _ = unpack(vim.api.nvim_win_get_cursor(0)) local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
line = line:sub(first_bracket_i+1, last_bracket_i-1) line = line:sub(first_bracket_i+1, last_bracket_i-1)
local leading_pattern = "^[%s" local leading_pattern = '^[%s'
for k, _ in pairs(SPLIT_DELIMETERS) do for k, _ in pairs(SPLIT_DELIMETERS) do
leading_pattern = leading_pattern .. k leading_pattern = leading_pattern .. k
end end
leading_pattern = leading_pattern .. "]*" leading_pattern = leading_pattern .. ']*'
line = line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1) line = line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1)
line = line:gsub("[%s]*$", '', 1) line = line:gsub('[%s]*$', '', 1)
vim.api.nvim_buf_set_lines(0, row-1, row, false, {first_line}) vim.api.nvim_buf_set_lines(0, row-1, row, false, {first_line})
vim.api.nvim_buf_set_lines(0, row, row, false, {last_line}) vim.api.nvim_buf_set_lines(0, row, row, false, {last_line})
vim.api.nvim_buf_set_lines(0, row, row, false, {line}) vim.api.nvim_buf_set_lines(0, row, row, false, {line})
@@ -837,20 +841,20 @@ do -- split line {{{1
line:sub(split_indexes[#split_indexes], last_bracket_i-1) line:sub(split_indexes[#split_indexes], last_bracket_i-1)
) )
local leading_pattern = "^[%s" local leading_pattern = '^[%s'
for k, _ in pairs(SPLIT_DELIMETERS) do for k, _ in pairs(SPLIT_DELIMETERS) do
leading_pattern = leading_pattern .. k leading_pattern = leading_pattern .. k
end end
leading_pattern = leading_pattern .. "]*" leading_pattern = leading_pattern .. ']*'
-- Cleanup step -- Cleanup step
for i, middle_line in ipairs(middle_lines) do for i, middle_line in ipairs(middle_lines) do
middle_line = middle_line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1) middle_line = middle_line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1)
middle_line = middle_line:gsub("[%s]*$", '', 1) middle_line = middle_line:gsub('[%s]*$', '', 1)
middle_lines[i] = middle_line middle_lines[i] = middle_line
end end
if middle_lines[#middle_lines]:match("^%s*$") ~= nil then if middle_lines[#middle_lines]:match('^%s*$') ~= nil then
table.remove(middle_lines) table.remove(middle_lines)
end end
@@ -862,7 +866,7 @@ do -- split line {{{1
vim.keymap.set( vim.keymap.set(
'n', 'n',
",s", ',s',
split_line, split_line,
{ silent = true } { silent = true }
) )