Mercurial > vim
annotate src/testdir/test_smartindent.vim @ 15127:31a0127813cb v8.1.0574
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
commit https://github.com/vim/vim/commit/4af7259b2b35e85c590d54908fcd248d2c733be8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 9 15:00:52 2018 +0100
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Problem: 'commentstring' not used when adding fold marker in C.
Solution: Require white space before middle comment part. (mostly by
Hirohito Higashi)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Dec 2018 15:15:06 +0100 |
parents | 268b1036cd17 |
children | 63b02fcf1361 |
rev | line source |
---|---|
11943
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
1 " Tests for smartindent |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Tests for not doing smart indenting when it isn't set. |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 function! Test_nosmartindent() |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 new |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call append(0, [" some test text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 \ " test text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 \ "test text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 \ " test text"]) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 set nocindent nosmartindent autoindent |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 exe "normal! gg/some\<CR>" |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 exe "normal! 2cc#test\<Esc>" |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(" #test", getline(1)) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 enew! | close |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunction |
11943
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
16 |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
17 function MyIndent() |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
18 endfunction |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
19 |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
20 " When 'indentexpr' is set, setting 'si' has no effect. |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
21 function Test_smartindent_has_no_effect() |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
22 new |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
23 exe "normal! i\<Tab>one\<Esc>" |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
24 set noautoindent |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
25 set smartindent |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
26 set indentexpr= |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
27 exe "normal! Gotwo\<Esc>" |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
28 call assert_equal("\ttwo", getline("$")) |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
29 |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
30 set indentexpr=MyIndent |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
31 exe "normal! Gothree\<Esc>" |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
32 call assert_equal("three", getline("$")) |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
33 |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
34 delfunction! MyIndent |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
35 set autoindent& |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
36 set smartindent& |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
37 set indentexpr& |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
38 bwipe! |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
39 endfunction |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
40 |
268b1036cd17
patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
41 " vim: shiftwidth=2 sts=2 expandtab |