019_smarttab_expandtab_spec.lua (1594B)
1 -- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. 2 -- Also test that dv_ works correctly 3 4 local n = require('test.functional.testnvim')() 5 6 local feed, insert = n.feed, n.insert 7 local clear, feed_command, expect = n.clear, n.feed_command, n.expect 8 9 describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function() 10 setup(clear) 11 12 -- luacheck: ignore 621 (Indentation) 13 it('is working', function() 14 insert([[ 15 start text 16 some test text 17 test text 18 other test text 19 a cde 20 f ghi 21 test text 22 Second line beginning with whitespace]]) 23 24 feed_command('set smarttab expandtab ts=8 sw=4') 25 -- Make sure that backspace works, no matter what termcap is used. 26 feed_command('set t_kD=x7f t_kb=x08') 27 28 feed_command('/some') 29 feed('r ') 30 feed_command('set noexpandtab') 31 feed_command('/other') 32 feed('r <cr>') 33 -- Test replacing with Tabs and then backspacing to undo it. 34 feed('0wR <bs><bs><bs><esc><cr>') 35 -- Test replacing with Tabs. 36 feed('0wR <esc><cr>') 37 -- Test that copyindent works with expandtab set. 38 feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8') 39 feed('o{<cr>x<esc>') 40 feed_command('set nosol') 41 feed_command('/Second line/') 42 -- Test "dv_" 43 feed('fwdv_') 44 45 -- Assert buffer contents. 46 expect([[ 47 start text 48 ome test text 49 test text 50 ther test text 51 a cde 52 hi 53 test text 54 { 55 x 56 with whitespace]]) 57 end) 58 end)