aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/keymap_spec.lua
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2024-01-20 08:08:44 +0800
committerGitHub <noreply@github.com>2024-01-20 08:08:44 +0800
commit98a4ed0a110625e63950d85b26f3e4614393ea04 (patch)
treec2a51aa96d1b99e97c01bd8303334bd3eb302044 /test/functional/api/keymap_spec.lua
parentd3a8e9217f39c59dd7762bd22a76b8bd03ca85ff (diff)
downloadrneovim-98a4ed0a110625e63950d85b26f3e4614393ea04.tar.gz
rneovim-98a4ed0a110625e63950d85b26f3e4614393ea04.tar.bz2
rneovim-98a4ed0a110625e63950d85b26f3e4614393ea04.zip
feat(api): support getting abbreviations (#26868)
Diffstat (limited to 'test/functional/api/keymap_spec.lua')
-rw-r--r--test/functional/api/keymap_spec.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index 4f57f6d0bd..0decd710e9 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -460,6 +460,57 @@ describe('nvim_get_keymap', function()
desc = 'map description',
}, api.nvim_get_keymap('n')[1])
end)
+
+ it('can get abbreviations', function()
+ command('inoreabbr foo bar')
+ command('cnoreabbr <buffer> foo baz')
+
+ local mapargs_i = {
+ abbr = 1,
+ buffer = 0,
+ expr = 0,
+ lhs = 'foo',
+ lhsraw = 'foo',
+ lnum = 0,
+ mode = 'i',
+ mode_bits = 0x10,
+ noremap = 1,
+ nowait = 0,
+ rhs = 'bar',
+ script = 0,
+ scriptversion = 1,
+ sid = 0,
+ silent = 0,
+ }
+ local mapargs_c = {
+ abbr = 1,
+ buffer = 1,
+ expr = 0,
+ lhs = 'foo',
+ lhsraw = 'foo',
+ lnum = 0,
+ mode = 'c',
+ mode_bits = 0x08,
+ noremap = 1,
+ nowait = 0,
+ rhs = 'baz',
+ script = 0,
+ scriptversion = 1,
+ sid = 0,
+ silent = 0,
+ }
+
+ local curbuf = api.nvim_get_current_buf()
+
+ eq({ mapargs_i }, api.nvim_get_keymap('ia'))
+ eq({}, api.nvim_buf_get_keymap(curbuf, 'ia'))
+
+ eq({}, api.nvim_get_keymap('ca'))
+ eq({ mapargs_c }, api.nvim_buf_get_keymap(curbuf, 'ca'))
+
+ eq({ mapargs_i }, api.nvim_get_keymap('!a'))
+ eq({ mapargs_c }, api.nvim_buf_get_keymap(curbuf, '!a'))
+ end)
end)
describe('nvim_set_keymap, nvim_del_keymap', function()