Merge pull request #100 from mikatpt/quit-bindings

Add convenience bindings for exiting quick menu
This commit is contained in:
ThePrimeagen 2021-10-14 10:01:59 -06:00 committed by GitHub
commit 7bf7929a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -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 `<ESC>`, 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 <c-w>gF to any errors arising

View File

@ -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

View File

@ -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()<CR>",
{ silent = true }
)
vim.api.nvim_buf_set_keymap(
Harpoon_bufh,
"n",
"<ESC>",
":lua require('harpoon.ui').toggle_quick_menu()<CR>",
{ 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 <buffer> ++nested ++once :silent lua require('harpoon.ui').toggle_quick_menu()"
)
end
M.select_menu_item = function()