From fe0424d696be7220c98c1c89f700e29a9c0c593c Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 8 Sep 2023 20:18:59 +0800 Subject: Update neovim config. --- configs/nvim/lua/crupest-util.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'configs/nvim/lua/crupest-util.lua') diff --git a/configs/nvim/lua/crupest-util.lua b/configs/nvim/lua/crupest-util.lua index c2bb727..3d1e9b2 100644 --- a/configs/nvim/lua/crupest-util.lua +++ b/configs/nvim/lua/crupest-util.lua @@ -1,7 +1,7 @@ local M = {} M.clean_path = function (path) - return path and ({string.gsub(path, "[/\\]+", "/")})[1] + return path and (string.gsub(path, "[/\\]+", "/")) end M.get_exe = function (path) @@ -61,4 +61,18 @@ M.find_npm_exe = function (path, exe) return nil end +function M.remove_element(tbl, element) + local index = nil + for i, v in ipairs(tbl) do + if element == v then + index = i + break + end + end + if index then + table.remove(tbl, index) + end + return tbl +end + return M -- cgit v1.2.3