Skip to content

Commit

Permalink
feat(configs): use <Esc> in normal mode to close current menu
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Dec 23, 2023
1 parent 10b2873 commit ee3a356
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ https://github.com/Bekaboo/dropbar.nvim/assets/76579810/e8c1ac26-0321-4762-9975-
- `<CR>`: find the first clickable symbol in the current drop-down menu
entry and call its `on_click` callback
- `i`: enter fzf mode from the menu
- `q`: close current menu
- `q` / `<Esc>`: close current menu
- To disable, remap or add new keymaps in the drop-down menu, see
[menu options](#menu)

Expand Down Expand Up @@ -464,6 +464,8 @@ vim.ui.select = require('dropbar.utils.menu').select
},
---@type table<string, string|function|table<string, string|function>>
keymaps = {
['q'] = '<C-w>q',
['<Esc>'] = '<C-w>q',
['<LeftMouse>'] = function()
local menu = utils.menu.get_current()
if not menu then
Expand Down Expand Up @@ -512,12 +514,6 @@ vim.ui.select = require('dropbar.utils.menu').select
end
menu:fuzzy_find_open()
end,
['q'] = function()
local menu = utils.menu.get_current()
if menu then
menu:close()
end
end
},
---@alias dropbar_menu_win_config_opts_t any|fun(menu: dropbar_menu_t):any
---@type table<string, dropbar_menu_win_config_opts_t>
Expand Down Expand Up @@ -1091,6 +1087,8 @@ menu:
- Default:
```lua
{
['q'] = '<C-w>q',
['<Esc>'] = '<C-w>q',
['<LeftMouse>'] = function()
local menu = utils.menu.get_current()
if not menu then
Expand Down Expand Up @@ -1139,12 +1137,6 @@ menu:
end
menu:fuzzy_find_open()
end,
['q'] = function()
local menu = utils.menu.get_current()
if menu then
menu:close()
end
end
},
```

Expand Down
10 changes: 4 additions & 6 deletions doc/dropbar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ USAGE *dropbar-usage*
click
- `<CR>`: find the first clickable symbol in the current drop-down menu
entry and call its `on_click` callback
- `i`: enter fzf mode from the menu
- `q` / `<Esc>`: close current menu
- To disable, remap or add new keymaps in the drop-down menu, see
|dropbar-configuration-options|

Expand Down Expand Up @@ -496,6 +498,8 @@ the menu:
to map a key in specific modes.
- Default: >lua
{
['q'] = '<C-w>q',
['<Esc>'] = '<C-w>q',
['<LeftMouse>'] = function()
local menu = utils.menu.get_current()
if not menu then
Expand Down Expand Up @@ -547,12 +551,6 @@ the menu:
end
menu:fuzzy_find_open()
end,
['q'] = function()
local menu = utils.menu.get_current()
if menu then
menu:close()
end
end
},
<
- `opts.menu.scrollbar`: `table<string, boolean>`
Expand Down
8 changes: 2 additions & 6 deletions lua/dropbar/configs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ M.opts = {
},
---@type table<string, string|function|table<string, string|function>>
keymaps = {
['q'] = '<C-w>q',
['<Esc>'] = '<C-w>q',
['<LeftMouse>'] = function()
local menu = utils.menu.get_current()
if not menu then
Expand Down Expand Up @@ -266,12 +268,6 @@ M.opts = {
end
menu:fuzzy_find_open()
end,
['q'] = function()
local menu = utils.menu.get_current()
if menu then
menu:close()
end
end,
},
---@alias dropbar_menu_win_config_opts_t any|fun(menu: dropbar_menu_t):any
---@type table<string, dropbar_menu_win_config_opts_t>
Expand Down

0 comments on commit ee3a356

Please sign in to comment.