summaryrefslogtreecommitdiffstats
path: root/after/indent/jsx.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2016-01-22 09:08:00 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2016-01-22 09:08:00 +0100
commit61390f58850c34b27d2a28dc14ebd760de152cc9 (patch)
treeef4822fc1f712ef0e2bdc50a435d7ef590da4d77 /after/indent/jsx.vim
parentf8a0fb37bf57fdf705747cc3aacbe50b6b2d6482 (diff)
downloadvim-polyglot-61390f58850c34b27d2a28dc14ebd760de152cc9.tar.gz
vim-polyglot-61390f58850c34b27d2a28dc14ebd760de152cc9.zip
Update
Diffstat (limited to 'after/indent/jsx.vim')
-rw-r--r--after/indent/jsx.vim12
1 files changed, 6 insertions, 6 deletions
diff --git a/after/indent/jsx.vim b/after/indent/jsx.vim
index f4c36662..e5fdb45d 100644
--- a/after/indent/jsx.vim
+++ b/after/indent/jsx.vim
@@ -26,8 +26,8 @@ setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
" XML indentkeys
setlocal indentkeys+=*<Return>,<>>,<<>,/
-" Self-closing tag regex.
-let s:sctag = '^\s*\/>\s*;\='
+" Multiline end tag regex (line beginning with '>' or '/>')
+let s:endtag = '^\s*\/\?>\s*;\='
" Get all syntax types at the beginning of a given line.
fu! SynSOL(lnum)
@@ -76,13 +76,13 @@ fu! GetJsxIndent()
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) && SynXMLishAny(cursyn)
let ind = XmlIndentGet(v:lnum, 0)
- " Align '/>' with '<' for multiline self-closing tags.
- if getline(v:lnum) =~? s:sctag
+ " Align '/>' and '>' with '<' for multiline tags.
+ if getline(v:lnum) =~? s:endtag
let ind = ind - &sw
endif
- " Then correct the indentation of any JSX following '/>'.
- if getline(v:lnum - 1) =~? s:sctag
+ " Then correct the indentation of any JSX following '/>' or '>'.
+ if getline(v:lnum - 1) =~? s:endtag
let ind = ind + &sw
endif
else