aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-01 21:37:01 +0800
committerGitHub <noreply@github.com>2022-06-01 21:37:01 +0800
commit96c494dec345f9a3dd2676048292267552e3f5f8 (patch)
tree20be26182c603ee6126624b6d90741c16e1e6f65 /test/functional
parentf40adf770d090d12f7b14dd519fe649ada40bfe6 (diff)
downloadrneovim-96c494dec345f9a3dd2676048292267552e3f5f8.tar.gz
rneovim-96c494dec345f9a3dd2676048292267552e3f5f8.tar.bz2
rneovim-96c494dec345f9a3dd2676048292267552e3f5f8.zip
refactor: correct comments and assertions about mapping rhs <Nop> (#18821)
Also avoid referring to mappings as "keymaps" in commands and docs. *map_empty_rhs* *map-empty-rhs* You can create an empty {rhs} by typing nothing after a single CTRL-V (you have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc file.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/keymap_spec.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index 4fb2d55a76..4bee10a006 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -321,7 +321,7 @@ describe('nvim_get_keymap', function()
eq({space_table}, meths.get_keymap('n'))
end)
- it('can handle lua keymaps', function()
+ it('can handle lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
@@ -606,6 +606,13 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
eq({''}, curbufmeths.get_lines(0, -1, 0))
eq(generate_mapargs('i', 'lhs', '<NOP>', {}),
get_mapargs('i', 'lhs'))
+
+ -- a single ^V in RHS is also <Nop> (see :h map-empty-rhs)
+ meths.set_keymap('i', 'lhs', '\022', {})
+ command('normal ilhs')
+ eq({''}, curbufmeths.get_lines(0, -1, 0))
+ eq(generate_mapargs('i', 'lhs', '\022', {}),
+ get_mapargs('i', 'lhs'))
end)
it('treats an empty RHS in a mapping like a <Nop>', function()
@@ -785,7 +792,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
end)
- it (':map command shows lua keymap correctly', function()
+ it (':map command shows lua mapping correctly', function()
exec_lua [[
vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() print('jkl;') end })
]]
@@ -793,7 +800,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
"^\nn asdf <Lua function %d+>"))
end)
- it ('mapcheck() returns lua keymap correctly', function()
+ it ('mapcheck() returns lua mapping correctly', function()
exec_lua [[
vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() print('jkl;') end })
]]
@@ -801,7 +808,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
"^<Lua function %d+>"))
end)
- it ('maparg() returns lua keymap correctly', function()
+ it ('maparg() returns lua mapping correctly', function()
exec_lua [[
vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() print('jkl;') end })
]]
@@ -895,7 +902,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
eq('\nNo mapping found', helpers.exec_capture('nmap <C-I>'))
end)
- it('can set descriptions on keymaps', function()
+ it('can set descriptions on mappings', function()
meths.set_keymap('n', 'lhs', 'rhs', {desc="map description"})
eq(generate_mapargs('n', 'lhs', 'rhs', {desc="map description"}), get_mapargs('n', 'lhs'))
eq("\nn lhs rhs\n map description",