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 | |
| parent | 46b7a1819af69c235edee23635cb1e2aca12bbfb (diff) | |
| parent | 312ae1da54e7f72c02da565aebb106590a3fa863 (diff) | |
| download | dotfiles-938cc9c18b476f3d45d0a06bf2a94c860a7aff7b.tar.gz dotfiles-938cc9c18b476f3d45d0a06bf2a94c860a7aff7b.zip | |
Merge commit '6006e9c4c6da59a57c87f0b23b674af5feaa24fb'
Diffstat (limited to '.config/nvim/lua/user')
| -rw-r--r-- | .config/nvim/lua/user/keys.lua | 9 | ||||
| -rw-r--r-- | .config/nvim/lua/user/mods.lua | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua index a6be1e5..64e7cb0 100644 --- a/.config/nvim/lua/user/keys.lua +++ b/.config/nvim/lua/user/keys.lua @@ -59,8 +59,8 @@ map('n', '<Leader>m', ':marks<CR>') -- Messages map('n', '<Leader>M', ':messages<CR>') --- Clear messages or just refresh/redraw the screen -map('n', '<leader>u', ":echo '' | redraw<CR>") +--- Clear messages or just refresh/redraw the screen +map('n', '<leader>i', "<cmd>lua require('notify').dismiss()<CR>") -- Unsets the 'last search pattern' register by hitting return --map("n", "<CR>", "!silent :noh<CR><CR>") @@ -443,4 +443,7 @@ map('n', '<leader>H', '<CMD>lua require("plugins.hardtime").ToggleHardtime()<CR> map('n', '<leader>rr', '<CMD>lua require("user.mods").toggleCodeRunner()<CR>') -- Run executable file -map('n', '<leader>rc', ":lua require('user.mods').RunCurrentFile()<CR>:echom 'Running executable file...'<CR>:sl!<CR>:echo ''<CR>") +map('n', '<leader>rx', ":lua require('user.mods').RunCurrentFile()<CR>:echom 'Running executable file...'<CR>:sl!<CR>:echo ''<CR>") + +-- Close all floating windows +map('n', '<leader>cw', '<CMD>CloseFloatingWindows<CR>') 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 |
