mirror of
https://github.com/neovim/neovim.git
synced 2025-12-09 16:12:48 +00:00
keymap: Support <D-...> (super/command key).
Adds support for:
- api:vim_input("<D-a>")
- ":nnoremap <C-D-S-...>" and permutations thereof
UIs must capture the modifier and send it as "<D-...>" to vim_input().
Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>"
mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This
commit supports "D-" as a modifier that can be combined with "C-", "A-",
"S-" in any order.
For non-GUI (terminal) support, user must:
:set <D-a>={CSI sequence}
then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).
Closes #2190
This commit is contained in:
@@ -144,15 +144,23 @@ describe('vim_* functions', function()
|
||||
|
||||
describe('replace_termcodes', function()
|
||||
it('escapes K_SPECIAL as K_SPECIAL KS_SPECIAL KE_FILLER', function()
|
||||
eq(helpers.nvim('replace_termcodes', '\128', true, true, true), '\128\254X')
|
||||
eq('\128\254X', helpers.nvim('replace_termcodes', '\128', true, true, true))
|
||||
end)
|
||||
|
||||
it('leaves non K_SPECIAL string unchanged', function()
|
||||
eq(helpers.nvim('replace_termcodes', 'abc', true, true, true), 'abc')
|
||||
it('leaves non-K_SPECIAL string unchanged', function()
|
||||
eq('abc', helpers.nvim('replace_termcodes', 'abc', true, true, true))
|
||||
end)
|
||||
|
||||
it('converts <expressions>', function()
|
||||
eq(helpers.nvim('replace_termcodes', '<Leader>', true, true, true), '\\')
|
||||
eq('\\', helpers.nvim('replace_termcodes', '<Leader>', true, true, true))
|
||||
end)
|
||||
|
||||
it('converts <LeftMouse> to K_SPECIAL KS_EXTRA KE_LEFTMOUSE', function()
|
||||
-- K_SPECIAL KS_EXTRA KE_LEFTMOUSE
|
||||
-- 0x80 0xfd 0x2c
|
||||
-- 128 253 44
|
||||
eq('\128\253\44', helpers.nvim('replace_termcodes',
|
||||
'<LeftMouse>', true, true, true))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user