diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-03-03 15:36:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-03-03 15:36:59 +0200 |
| commit | d3db66035ac76623ccf525640cdac22fedce57ab (patch) | |
| tree | 58d0ff739faeae26f482d3ae7d7dc59692448200 | |
| parent | 50d0c70863f61eb5f5e2387a43cc2a8971468c2f (diff) | |
| download | dotfiles-d3db66035ac76623ccf525640cdac22fedce57ab.tar.gz dotfiles-d3db66035ac76623ccf525640cdac22fedce57ab.zip | |
Use q to quit on floating windows otherwise still use it for macros (conditional)
| -rw-r--r-- | lua/user/keys.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lua/user/keys.lua b/lua/user/keys.lua index c957e05..f2ce98d 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -29,6 +29,16 @@ map("n", "<leader><CR>", "<cmd>luafile ~/.config/nvim/init.lua<CR> | :echom ('Nv --------------- Extended Operations --------------- +-- Use q to quit on floating windows otherwise still use it for macros +map('n', 'q', function() + local config = vim.api.nvim_win_get_config(0) + if config.relative ~= "" then -- is_floating_window? + return ":close<CR>" + else + return "q" + end +end, {expr = true, replace_keycodes = true}) + -- Combine buffers list with buffer name map("n", "<Leader>b", ":buffers<CR>:buffer<Space>") |
