diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-11-05 13:00:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-11-05 13:00:59 +0200 |
| commit | 938cc9c18b476f3d45d0a06bf2a94c860a7aff7b (patch) | |
| tree | d075853870d54766ad20c9987eedb3476093ce76 /.config/nvim/lua/user/mods.lua | |
| parent | 46b7a1819af69c235edee23635cb1e2aca12bbfb (diff) | |
| parent | 312ae1da54e7f72c02da565aebb106590a3fa863 (diff) | |
| download | dotfiles-938cc9c18b476f3d45d0a06bf2a94c860a7aff7b.tar.gz dotfiles-938cc9c18b476f3d45d0a06bf2a94c860a7aff7b.zip | |
Merge commit '6006e9c4c6da59a57c87f0b23b674af5feaa24fb'
Diffstat (limited to '.config/nvim/lua/user/mods.lua')
| -rw-r--r-- | .config/nvim/lua/user/mods.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/.config/nvim/lua/user/mods.lua b/.config/nvim/lua/user/mods.lua index 49027da..c4431df 100644 --- a/.config/nvim/lua/user/mods.lua +++ b/.config/nvim/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 |
