diff options
author | crupest <crupest@outlook.com> | 2023-09-08 20:18:59 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-09-11 23:14:35 +0800 |
commit | e2c8efa08826eb694e8e293a14e0f29fc48f6c31 (patch) | |
tree | 2f0849fda814cfe4e7b33aadf546010da21be255 /configs/nvim/lua/crupest-util.lua | |
parent | 5edcda657e72dea53360501b8efeeff8862a21a9 (diff) | |
download | crupest-e2c8efa08826eb694e8e293a14e0f29fc48f6c31.tar.gz crupest-e2c8efa08826eb694e8e293a14e0f29fc48f6c31.tar.bz2 crupest-e2c8efa08826eb694e8e293a14e0f29fc48f6c31.zip |
Update neovim config.
Diffstat (limited to 'configs/nvim/lua/crupest-util.lua')
-rw-r--r-- | configs/nvim/lua/crupest-util.lua | 16 |
1 files changed, 15 insertions, 1 deletions
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 |