From 09b60df3dc3cafbdcdc47bdd4171bce715dedac5 Mon Sep 17 00:00:00 2001 From: Dean G <97860672+gaoDean@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:05:32 +1100 Subject: [PATCH] style: stylua (#52) --- lua/autolist/init.lua | 29 +++++++++++------------------ lua/autolist/utils.lua | 3 ++- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lua/autolist/init.lua b/lua/autolist/init.lua index 1011c91..e1bd816 100644 --- a/lua/autolist/init.lua +++ b/lua/autolist/init.lua @@ -22,25 +22,18 @@ M.create_mapping_hook = function(mode, mapping, func, alias) pcall(vim.keymap.del, mode, mapping) end end - vim.keymap.set( - mode, - mapping, - function(motion) - local additional_map = nil - if additional_function then - if type(additional_function) == "string" then - local ok, res = pcall(load("return " .. additional_function)) - if ok then - additional_map = res or "" - end - else - additional_map = additional_function() or "" - end + vim.keymap.set(mode, mapping, function(motion) + local additional_map = nil + if additional_function then + if type(additional_function) == "string" then + local ok, res = pcall(load("return " .. additional_function)) + if ok then additional_map = res or "" end + else + additional_map = additional_function() or "" end - return func(motion, additional_map or mapping) or "" - end, - { expr = true, buffer = true } - ) + end + return func(motion, additional_map or mapping) or "" + end, { expr = true, buffer = true }) end return M diff --git a/lua/autolist/utils.lua b/lua/autolist/utils.lua index 12b3310..756bd38 100644 --- a/lua/autolist/utils.lua +++ b/lua/autolist/utils.lua @@ -200,7 +200,8 @@ function M.get_list_start(cur_linenum, list_types) local cur_indent = M.get_indent_lvl(line) if cur_indent < 0 then cur_indent = 0 end if list_types then - while M.is_list(line, list_types) + while + M.is_list(line, list_types) and M.get_indent_lvl(line) >= cur_indent do linenum = linenum - 1