diff options
Diffstat (limited to 'lua/user/mods.lua')
| -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 |
