Improve macro & dot-repeat support (#363)

* manual support dot-repeat

* cmdwin and terminal

* cmdline only

* Fix

* fix

* Improve

* Fix test

* Support macro

* disable cmdline for now

* Simplify

* fmt

* consume once

* Ignore = type

* cmdline

* Remove cmdline features
This commit is contained in:
hrsh7th
2021-10-16 23:37:32 +09:00
committed by GitHub
parent f0a6cca5b9
commit 0f28030aef
13 changed files with 279 additions and 84 deletions

View File

@@ -17,6 +17,26 @@ describe('keymap', function()
assert.are.equal(keymap.escape('<LT>C-d>'), '<LT>C-d>')
end)
describe('feedkeys', function()
it('dot-repeat', function()
vim.fn.setreg('".', '')
keymap.feedkeys(keymap.t('i'), 'nt')
keymap.feedkeys(keymap.t('aiueo<Esc>'), 'nt')
keymap.feedkeys(keymap.t('<Ignore>'), 'nx')
assert.are.equal(vim.fn.getreg('".'), keymap.t('iaiueo<Esc>'))
end)
it('macro', function()
vim.fn.setreg('q', '')
vim.cmd([[normal! qq]])
keymap.feedkeys(keymap.t('iaiueo'), 'nt')
keymap.feedkeys(keymap.t('<Esc>'), 'nt', function()
vim.cmd([[normal! q]])
assert.are.equal(vim.fn.getreg('q'), keymap.t('iaiueo<Esc>'))
print(vim.fn.getreg('q'))
end)
end)
end)
describe('evacuate', function()
before_each(spec.before)