normal_spec.lua 1007 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local clear = helpers.clear
  3. local command = helpers.command
  4. local funcs = helpers.funcs
  5. local feed = helpers.feed
  6. local expect = helpers.expect
  7. local eq = helpers.eq
  8. local eval = helpers.eval
  9. before_each(clear)
  10. describe(':normal!', function()
  11. it('can get out of Insert mode if called from Ex mode #17924', function()
  12. feed('gQnormal! Ifoo<CR>')
  13. expect('foo')
  14. end)
  15. it('does not execute command in Ex mode when running out of characters', function()
  16. command('let g:var = 0')
  17. command('normal! gQlet g:var = 1')
  18. eq(0, eval('g:var'))
  19. end)
  20. it('gQinsert does not hang #17980', function()
  21. command('normal! gQinsert')
  22. expect('')
  23. end)
  24. it('can stop Visual mode without closing cmdwin vim-patch:9.0.0234', function()
  25. feed('q:')
  26. feed('v')
  27. eq('v', funcs.mode(1))
  28. eq(':', funcs.getcmdwintype())
  29. command('normal! \027')
  30. eq('n', funcs.mode(1))
  31. eq(':', funcs.getcmdwintype())
  32. end)
  33. end)