]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix indent with syntax off
authorHiroshi Shirosaki <h.shirosaki@gmail.com>
Mon, 16 Nov 2015 06:43:39 +0000 (15:43 +0900)
committerHiroshi Shirosaki <h.shirosaki@gmail.com>
Mon, 16 Nov 2015 06:43:39 +0000 (15:43 +0900)
Move indent related settings from syntax to index.
Fix #126

indent/markdown.vim
syntax/markdown.vim
test/indent.vader [new file with mode: 0644]

index fb8d95d2453213aa19ae39aed8480ff1972522ba..23944f242b5029c94a22a9fd8100574387e98ec1 100755 (executable)
@@ -5,6 +5,16 @@ setlocal indentexpr=GetMarkdownIndent()
 setlocal nolisp
 setlocal autoindent
 
 setlocal nolisp
 setlocal autoindent
 
+" Automatically insert bullets
+setlocal formatoptions+=r
+" Do not automatically insert bullets when auto-wrapping with text-width
+setlocal formatoptions-=c
+" Accept various markers as bullets
+setlocal comments=b:*,b:+,b:-
+
+" Automatically continue blockquote on line break
+setlocal comments+=b:>
+
 " Only define the function once
 if exists("*GetMarkdownIndent") | finish | endif
 
 " Only define the function once
 if exists("*GetMarkdownIndent") | finish | endif
 
index 60a675ddad0b6a542d2b8c3d604991eea6ea411e..bacb5a11d2c8445ad9d1fb792da780fd9906af9d 100644 (file)
@@ -130,16 +130,6 @@ HtmlHiLink mkdLinkTitle     htmlString
 HtmlHiLink mkdMath          Statement
 HtmlHiLink mkdDelimiter     Delimiter
 
 HtmlHiLink mkdMath          Statement
 HtmlHiLink mkdDelimiter     Delimiter
 
-" Automatically insert bullets
-setlocal formatoptions+=r
-" Do not automatically insert bullets when auto-wrapping with text-width
-setlocal formatoptions-=c
-" Accept various markers as bullets
-setlocal comments=b:*,b:+,b:-
-
-" Automatically continue blockquote on line break
-setlocal comments+=b:>
-
 let b:current_syntax = "mkd"
 
 delcommand HtmlHiLink
 let b:current_syntax = "mkd"
 
 delcommand HtmlHiLink
diff --git a/test/indent.vader b/test/indent.vader
new file mode 100644 (file)
index 0000000..76f4990
--- /dev/null
@@ -0,0 +1,24 @@
+Given markdown;
+* item1
+
+Do (Insert enter at list end):
+  A\<Enter>item2
+
+Expect (auto insert * and indent level is same):
+  * item1
+  * item2
+
+Given markdown;
+
+Execute:
+  syntax off
+
+Do (Insert enter at list end with syntax off):
+  i* item1\<Enter>item2
+
+Expect (auto insert * and indent level is same):
+  * item1
+  * item2
+
+Execute:
+  syntax on