diff --git a/README.md b/README.md index 37c9c1d..af9cb37 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ You can simply edit this list as if it were a document in vim. `:wq` to save the new edits or `:q` to ignore the edits. There is to save upon call to toggle if you prefer that way. +You can also exit the list with `q` or ``, which will call `toggle_quick_menu()` again. + ### Terminal Navigation #### Motivation for terminals in neovim I want to use the terminal since I can gF and gF to any errors arising diff --git a/lua/harpoon/term.lua b/lua/harpoon/term.lua index 3700904..fef47ec 100644 --- a/lua/harpoon/term.lua +++ b/lua/harpoon/term.lua @@ -78,7 +78,7 @@ M.sendCommand = function(idx, cmd, ...) end if global_config.enter_on_sendcmd then - cmd = cmd .. "\n" + cmd = cmd .. "\n" end if cmd then diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index d82e5d9..ece2b3c 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -99,6 +99,20 @@ M.toggle_quick_menu = function() vim.api.nvim_buf_set_option(Harpoon_bufh, "filetype", "harpoon") vim.api.nvim_buf_set_option(Harpoon_bufh, "buftype", "acwrite") vim.api.nvim_buf_set_option(Harpoon_bufh, "bufhidden", "delete") + vim.api.nvim_buf_set_keymap( + Harpoon_bufh, + "n", + "q", + ":lua require('harpoon.ui').toggle_quick_menu()", + { silent = true } + ) + vim.api.nvim_buf_set_keymap( + Harpoon_bufh, + "n", + "", + ":lua require('harpoon.ui').toggle_quick_menu()", + { silent = true } + ) vim.api.nvim_buf_set_keymap( Harpoon_bufh, "n", @@ -126,6 +140,9 @@ M.toggle_quick_menu = function() Harpoon_bufh ) ) + vim.cmd( + "autocmd BufLeave ++nested ++once :silent lua require('harpoon.ui').toggle_quick_menu()" + ) end M.select_menu_item = function()