local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local command = helpers.command local eq = helpers.eq local eval = helpers.eval local feed = helpers.feed local meths = helpers.meths before_each(clear) describe('Ex mode', function() it('supports command line editing', function() local function test_ex_edit(expected, cmd) feed('gQ' .. cmd .. '"') local ret = eval('@:[1:]') -- Remove leading quote. feed('visual') eq(meths.replace_termcodes(expected, true, true, true), ret) end command('set sw=2') test_ex_edit('bar', 'foo barbar') test_ex_edit('12', '12') test_ex_edit('213', '123') test_ex_edit('2013', '0123') test_ex_edit('0213', '0123') test_ex_edit('0342', '01234') test_ex_edit('foo ', 'foo bar') test_ex_edit('foo', 'fooba') test_ex_edit('foobar', 'foobar') test_ex_edit('abbreviate', 'abbrev') test_ex_edit('1', '1') test_ex_edit('1', '1') test_ex_edit(' foo', ' foo') test_ex_edit(' foo0', ' foo0') test_ex_edit(' foo^', ' foo^') end) end)