From ee3a356254ab494c0e280b809969a7a3a7e38fb7 Mon Sep 17 00:00:00 2001 From: bekaboo <18127878294@qq.com> Date: Sat, 23 Dec 2023 12:40:10 +0800 Subject: [PATCH] feat(configs): use `` in normal mode to close current menu --- README.md | 18 +++++------------- doc/dropbar.txt | 10 ++++------ lua/dropbar/configs.lua | 8 ++------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 8bdfc339..73c4b352 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ https://github.com/Bekaboo/dropbar.nvim/assets/76579810/e8c1ac26-0321-4762-9975- - ``: 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` / ``: close current menu - To disable, remap or add new keymaps in the drop-down menu, see [menu options](#menu) @@ -464,6 +464,8 @@ vim.ui.select = require('dropbar.utils.menu').select }, ---@type table> keymaps = { + ['q'] = 'q', + [''] = 'q', [''] = function() local menu = utils.menu.get_current() if not menu then @@ -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 @@ -1091,6 +1087,8 @@ menu: - Default: ```lua { + ['q'] = 'q', + [''] = 'q', [''] = function() local menu = utils.menu.get_current() if not menu then @@ -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 }, ``` diff --git a/doc/dropbar.txt b/doc/dropbar.txt index 81e93cb1..d150239d 100644 --- a/doc/dropbar.txt +++ b/doc/dropbar.txt @@ -169,6 +169,8 @@ USAGE *dropbar-usage* click - ``: 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 - To disable, remap or add new keymaps in the drop-down menu, see |dropbar-configuration-options| @@ -496,6 +498,8 @@ the menu: to map a key in specific modes. - Default: >lua { + ['q'] = 'q', + [''] = 'q', [''] = function() local menu = utils.menu.get_current() if not menu then @@ -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` diff --git a/lua/dropbar/configs.lua b/lua/dropbar/configs.lua index adbf5348..8768a920 100644 --- a/lua/dropbar/configs.lua +++ b/lua/dropbar/configs.lua @@ -218,6 +218,8 @@ M.opts = { }, ---@type table> keymaps = { + ['q'] = 'q', + [''] = 'q', [''] = function() local menu = utils.menu.get_current() if not menu then @@ -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