Browse Source

Fix indent with syntax off

Move indent related settings from syntax to index.
Fix #126
Hiroshi Shirosaki 3 years ago
parent
commit
642730fccc
3 changed files with 34 additions and 10 deletions
  1. 10
    0
      indent/markdown.vim
  2. 0
    10
      syntax/markdown.vim
  3. 24
    0
      test/indent.vader

+ 10
- 0
indent/markdown.vim View File

@@ -5,6 +5,16 @@ setlocal indentexpr=GetMarkdownIndent()
5 5
 setlocal nolisp
6 6
 setlocal autoindent
7 7
 
8
+" Automatically insert bullets
9
+setlocal formatoptions+=r
10
+" Do not automatically insert bullets when auto-wrapping with text-width
11
+setlocal formatoptions-=c
12
+" Accept various markers as bullets
13
+setlocal comments=b:*,b:+,b:-
14
+
15
+" Automatically continue blockquote on line break
16
+setlocal comments+=b:>
17
+
8 18
 " Only define the function once
9 19
 if exists("*GetMarkdownIndent") | finish | endif
10 20
 

+ 0
- 10
syntax/markdown.vim View File

@@ -130,16 +130,6 @@ HtmlHiLink mkdLinkTitle     htmlString
130 130
 HtmlHiLink mkdMath          Statement
131 131
 HtmlHiLink mkdDelimiter     Delimiter
132 132
 
133
-" Automatically insert bullets
134
-setlocal formatoptions+=r
135
-" Do not automatically insert bullets when auto-wrapping with text-width
136
-setlocal formatoptions-=c
137
-" Accept various markers as bullets
138
-setlocal comments=b:*,b:+,b:-
139
-
140
-" Automatically continue blockquote on line break
141
-setlocal comments+=b:>
142
-
143 133
 let b:current_syntax = "mkd"
144 134
 
145 135
 delcommand HtmlHiLink

+ 24
- 0
test/indent.vader View File

@@ -0,0 +1,24 @@
1
+Given markdown;
2
+* item1
3
+
4
+Do (Insert enter at list end):
5
+  A\<Enter>item2
6
+
7
+Expect (auto insert * and indent level is same):
8
+  * item1
9
+  * item2
10
+
11
+Given markdown;
12
+
13
+Execute:
14
+  syntax off
15
+
16
+Do (Insert enter at list end with syntax off):
17
+  i* item1\<Enter>item2
18
+
19
+Expect (auto insert * and indent level is same):
20
+  * item1
21
+  * item2
22
+
23
+Execute:
24
+  syntax on

Loading…
Cancel
Save