From eb0fc958b4e8c0a2cf6c5c534c950389aa66e000 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Thu, 7 Oct 2021 21:03:37 -0400 Subject: [PATCH 1/7] Add convenience bindings for exiting quick menu --- lua/harpoon/ui.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index d82e5d9..135eb2d 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -99,6 +99,8 @@ 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", ":q", { silent = true }) + vim.api.nvim_buf_set_keymap(Harpoon_bufh, "n", "", ":q", { silent = true }) vim.api.nvim_buf_set_keymap( Harpoon_bufh, "n", From d5753b4a83a4cf54c42172046d8ed5f8f7439e35 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Thu, 7 Oct 2021 21:20:24 -0400 Subject: [PATCH 2/7] Add line referencing quit mappings in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 37c9c1d..d52c781 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 also save your edits! + ### Terminal Navigation #### Motivation for terminals in neovim I want to use the terminal since I can gF and gF to any errors arising From 2225d62eea2db8d3e83907762caf62e26b62fae9 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Sat, 9 Oct 2021 13:50:27 -0400 Subject: [PATCH 3/7] Add autocmd to quit menu on BufLeave --- lua/harpoon/ui.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index 135eb2d..c0bfedd 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -128,6 +128,7 @@ 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() From 132da0d2477675fd5fffcc90586d1052c5fee430 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Sat, 9 Oct 2021 18:57:08 -0400 Subject: [PATCH 4/7] Fix formatting --- lua/harpoon/ui.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index c0bfedd..390c06c 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -99,8 +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", ":q", { silent = true }) - vim.api.nvim_buf_set_keymap(Harpoon_bufh, "n", "", ":q", { silent = true }) + vim.api.nvim_buf_set_keymap( + Harpoon_bufh, + "n", + "q", + ":q", + { silent = true } + ) + vim.api.nvim_buf_set_keymap( + Harpoon_bufh, + "n", + "", + ":q", + { silent = true } + ) vim.api.nvim_buf_set_keymap( Harpoon_bufh, "n", @@ -128,7 +140,9 @@ M.toggle_quick_menu = function() Harpoon_bufh ) ) - vim.cmd("autocmd BufLeave ++nested ++once :silent lua require('harpoon.ui').toggle_quick_menu()") + vim.cmd( + "autocmd BufLeave ++nested ++once :silent lua require('harpoon.ui').toggle_quick_menu()" + ) end M.select_menu_item = function() From 99892c60ba940996eeb677609af27602d26a6c95 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Mon, 11 Oct 2021 18:44:06 -0400 Subject: [PATCH 5/7] Linting --- lua/harpoon/term.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 70f054764b6a620d7d9fd3866013d2a2b4a30ac1 Mon Sep 17 00:00:00 2001 From: mikatpt Date: Mon, 11 Oct 2021 18:44:19 -0400 Subject: [PATCH 6/7] Change quit binding to use toggle_quick_menu() --- lua/harpoon/ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index 390c06c..ece2b3c 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -103,14 +103,14 @@ M.toggle_quick_menu = function() Harpoon_bufh, "n", "q", - ":q", + ":lua require('harpoon.ui').toggle_quick_menu()", { silent = true } ) 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( From 12bd7baf994b05b6585919c1e10a2f3f8e045bee Mon Sep 17 00:00:00 2001 From: mikatpt Date: Mon, 11 Oct 2021 18:52:37 -0400 Subject: [PATCH 7/7] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d52c781..af9cb37 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ 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 also save your edits! +You can also exit the list with `q` or ``, which will call `toggle_quick_menu()` again. ### Terminal Navigation #### Motivation for terminals in neovim