From d3db66035ac76623ccf525640cdac22fedce57ab Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 3 Mar 2023 15:36:59 +0200 Subject: Use q to quit on floating windows otherwise still use it for macros (conditional) --- lua/user/keys.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) 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", "", "luafile ~/.config/nvim/init.lua | :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" + else + return "q" + end +end, {expr = true, replace_keycodes = true}) + -- Combine buffers list with buffer name map("n", "b", ":buffers:buffer") -- cgit v1.2.3