Skip to content

Commit

Permalink
Fix indent with syntax off
Browse files Browse the repository at this point in the history
Move indent related settings from syntax to index.
Fix preservim#126
  • Loading branch information
shirosaki committed Nov 16, 2015
1 parent 67b59d5 commit 642730f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
10 changes: 10 additions & 0 deletions indent/markdown.vim
Expand Up @@ -5,6 +5,16 @@ setlocal indentexpr=GetMarkdownIndent()
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

Expand Down
10 changes: 0 additions & 10 deletions syntax/markdown.vim
Expand Up @@ -130,16 +130,6 @@ HtmlHiLink mkdLinkTitle htmlString
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
Expand Down
24 changes: 24 additions & 0 deletions test/indent.vader
@@ -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

0 comments on commit 642730f

Please sign in to comment.