summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_edit.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-26 20:04:54 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-26 20:04:54 +0200
commit1b38344e00af65df12946fffda7f3201621c35ef (patch)
tree164ba42c990c2ed7c7ffa903799b164c225060f2 /src/testdir/test_edit.vim
parent97fbc404fc56f76df12b2d2658b1d6efda28d5dd (diff)
patch 8.0.1154: 'indentkeys' does not work properlyv8.0.1154
Problem: 'indentkeys' does not work properly. (Gary Johnson) Solution: Get the cursor line again. (Christian Brabandt, closes #2151)
Diffstat (limited to 'src/testdir/test_edit.vim')
-rw-r--r--src/testdir/test_edit.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 0986bf9b1c..cc9540c77a 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -314,6 +314,33 @@ func! Test_edit_11()
bw!
endfunc
+func! Test_edit_11_indentexpr()
+ " Test that indenting kicks in
+ new
+ " Use indentexpr instead of cindenting
+ func! Do_Indent()
+ let pline=prevnonblank(v:lnum)
+ if empty(getline(v:lnum))
+ if getline(pline) =~ 'if\|then'
+ return shiftwidth()
+ else
+ return 0
+ endif
+ else
+ return 0
+ endif
+ endfunc
+ setl indentexpr=Do_Indent() indentkeys+=0=then,0=fi
+ call setline(1, ['if [ $this ]'])
+ call cursor(1, 1)
+ call feedkeys("othen\<cr>that\<cr>fi", 'tnix')
+ call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$'))
+ set cinkeys&vim indentkeys&vim
+ set nocindent indentexpr=
+ delfu Do_Indent
+ bw!
+endfunc
+
func! Test_edit_12()
" Test changing indent in replace mode
new