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 | fe0424d696be7220c98c1c89f700e29a9c0c593c (patch) | |
tree | 2f0849fda814cfe4e7b33aadf546010da21be255 | |
parent | 168eb58b08e94c8e2ab0cc71897d4222d86b55b0 (diff) | |
download | crupest-fe0424d696be7220c98c1c89f700e29a9c0c593c.tar.gz crupest-fe0424d696be7220c98c1c89f700e29a9c0c593c.tar.bz2 crupest-fe0424d696be7220c98c1c89f700e29a9c0c593c.zip |
Update neovim config.
-rw-r--r-- | configs/nvim/init.lua | 9 | ||||
-rw-r--r-- | configs/nvim/lua/crupest-util.lua | 16 |
2 files changed, 24 insertions, 1 deletions
diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index 10601be..d0e861f 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -285,3 +285,12 @@ require("catppuccin").setup{ vim.cmd.colorscheme "catppuccin" +vim.keymap.set("n", "<esc>", function () + local wins = vim.api.nvim_list_wins() + for _, v in ipairs(wins) do + if vim.api.nvim_win_get_config(v).relative ~= '' then + vim.api.nvim_win_close(v, false) + end + end +end) + 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 |