~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to test/functional/legacy/mapping_spec.lua

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-02-20 22:41:32 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: package-import@ubuntu.com-20160220224132-e24n8lh3yo5ylt23
Tags: upstream-0.1.2
Import upstream version 0.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
local helpers = require('test.functional.helpers')
4
4
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
5
 
local execute, expect = helpers.execute, helpers.expect
 
5
local execute, expect, wait = helpers.execute, helpers.expect, helpers.wait
6
6
 
7
7
describe('mapping', function()
8
8
  before_each(clear)
9
9
 
10
 
  it('is working', function()
 
10
  it('abbreviations with р (0x80)', function()
11
11
    insert([[
12
12
      test starts here:
13
13
      ]])
16
16
    execute('inoreab чкпр   vim')
17
17
    feed('GAчкпр <esc>')
18
18
 
 
19
    expect([[
 
20
      test starts here:
 
21
      vim ]])
 
22
  end)
 
23
 
 
24
  it('Ctrl-c works in Insert mode', function()
 
25
    -- Mapping of ctrl-c in insert mode
 
26
    execute('set cpo-=< cpo-=k')
 
27
    execute('inoremap <c-c> <ctrl-c>')
 
28
    execute('cnoremap <c-c> dummy')
 
29
    execute('cunmap <c-c>')
 
30
    feed('GA<cr>')
 
31
    feed('TEST2: CTRL-C |')
 
32
    wait()
 
33
    feed('<c-c>A|<cr><esc>')
 
34
    wait()
 
35
    execute('unmap <c-c>')
 
36
    execute('unmap! <c-c>')
 
37
 
 
38
    expect([[
 
39
      
 
40
      TEST2: CTRL-C |<ctrl-c>A|
 
41
      ]])
 
42
  end)
 
43
 
 
44
  it('Ctrl-c works in Visual mode', function()
 
45
    execute([[vnoremap <c-c> :<C-u>$put ='vmap works'<cr>]])
 
46
    feed('GV')
 
47
    -- XXX: For some reason the mapping is only triggered
 
48
    -- when <C-c> is in a separate feed command.
 
49
    wait()
 
50
    feed('<c-c>')
 
51
    execute('vunmap <c-c>')
 
52
 
 
53
    expect([[
 
54
      
 
55
      vmap works]])
 
56
  end)
 
57
 
 
58
  it('langmap', function()
19
59
    -- langmap should not get remapped in insert mode.
20
60
    execute('inoremap { FAIL_ilangmap')
21
61
    execute('set langmap=+{ langnoremap')
37
77
 
38
78
    -- Assert buffer contents.
39
79
    expect([[
40
 
      test starts here:
41
 
      vim 
 
80
      
42
81
      +
43
82
      +
44
83
      +
45
84
      +]])
46
85
  end)
47
86
 
 
87
  it('feedkeys', function()
 
88
    insert([[
 
89
      a b c d
 
90
      a b c d
 
91
      ]])
 
92
 
 
93
    -- Vim's issue #212 (feedkeys insert mapping at current position)
 
94
    execute('nnoremap . :call feedkeys(".", "in")<cr>')
 
95
    feed('/^a b<cr>')
 
96
    feed('0qqdw.ifoo<esc>qj0@q<esc>')
 
97
    execute('unmap .')
 
98
    expect([[
 
99
      fooc d
 
100
      fooc d
 
101
      ]])
 
102
  end)
 
103
 
48
104
  it('i_CTRL-G_U', function()
49
105
    -- <c-g>U<cursor> works only within a single line
50
106
    execute('imapclear')