Skip to content

Commit

Permalink
fix(configs & menu): default mapping in visual mode causes confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Dec 23, 2023
1 parent ffa55b3 commit 10b2873
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ menu:
- Default: `true`
- `opts.menu.keymaps`: `table<string, function|string|table<string, function>|table<string, string>>`
- Buffer-local keymaps in the menu
- Use `<key> = <function|string>` to map a key in normal mode and visual mode
in the menu buffer, or use `<key> = table<mode, function|string>` to map
- Use `<key> = <function|string>` to map a key in normal mode in the menu
buffer, or use `<key> = table<mode, function|string>` to map
a key in specific modes.
- Default:
```lua
Expand Down
4 changes: 2 additions & 2 deletions doc/dropbar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ the menu:
- `opts.menu.keymaps`:
`table<string, function|string|table<string, function>|table<string, string>>`
- Buffer-local keymaps in the menu
- Use `<key> = <function|string>` to map a key in normal mode and visual
mode in the menu buffer, or use `<key> = table<mode, function|string>`
- Use `<key> = <function|string>` to map a key in normal mode in the menu
buffer, or use `<key> = table<mode, function|string>`
to map a key in specific modes.
- Default: >lua
{
Expand Down
4 changes: 2 additions & 2 deletions lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ function dropbar_menu_t:make_buf()
vim.bo[self.buf].ft = 'dropbar_menu'

-- Set buffer-local keymaps
-- Default modes: normal and visual
-- Default modes: normal
for key, mapping in pairs(configs.opts.menu.keymaps) do
if type(mapping) == 'function' or type(mapping) == 'string' then
vim.keymap.set({ 'x', 'n' }, key, mapping, { buffer = self.buf })
vim.keymap.set('n', key, mapping, { buffer = self.buf })
elseif type(mapping) == 'table' then
for mode, rhs in pairs(mapping) do
vim.keymap.set(mode, key, rhs, { buffer = self.buf })
Expand Down

0 comments on commit 10b2873

Please sign in to comment.