diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-11-05 12:57:57 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-11-05 12:57:57 +0200 |
| commit | 61a3cc6db14c619e291601a773ad06988b293c8e (patch) | |
| tree | 1965e3561944cc79a0b08c365de2fc3c82cd7c8c | |
| parent | b3dee678493d308515fbee9d34d70c26c9f91c02 (diff) | |
| download | dotfiles-61a3cc6db14c619e291601a773ad06988b293c8e.tar.gz dotfiles-61a3cc6db14c619e291601a773ad06988b293c8e.zip | |
Add NvimTree1 to nvim-tree behaviour
| -rw-r--r-- | lua/user/mods.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lua/user/mods.lua b/lua/user/mods.lua index 49027da..c4431df 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -483,7 +483,7 @@ vim.api.nvim_create_autocmd({ 'VimLeave' }, { local modifiedBufs = function(bufs) -- nvim-tree is also there in modified buffers so this function filter it out local t = 0 for k, v in pairs(bufs) do - if v.name:match('NvimTree_') == nil then + if v.name:match('NvimTree_', 'NvimTree1') == nil then t = t + 1 end end @@ -1042,5 +1042,18 @@ end -------------------------------------------------- +-- Close all floating windows +vim.api.nvim_create_user_command('CloseFloatingWindows', function(opts) + for _, window_id in ipairs(vim.api.nvim_list_wins()) do + -- If window is floating + if vim.api.nvim_win_get_config(window_id).relative ~= '' then + -- Force close if called with ! + vim.api.nvim_win_close(window_id, opts.bang) + end + end +end, { bang = true, nargs = 0 }) + +-------------------------------------------------- + -- ... return M |
