Skip to content

Commit c74d992

Browse files
committed
fix(indent): more consistent indents for comments
refer: #3203, #3194
1 parent 2b1ca66 commit c74d992

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

indent/tex.vim

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ function! VimtexIndent(lnum) abort " {{{1
5151
return empty(l:line) ? indent(l:prev_lnum) : indent(a:lnum)
5252
endif
5353

54-
" Use previous indentation for comments
55-
if l:line =~# '^\s*%'
56-
return indent(l:prev_lnum)
57-
endif
58-
5954
" Remove comments before subsequent checks
6055
let l:line = s:clean_line(l:line)
6156

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\documentclass{minimal}
2+
\begin{document}
3+
4+
\begin{flushleft}
5+
% this comment IS indented like line below
6+
Hello world!
7+
\end{flushleft}
8+
9+
\begin{equation}
10+
a = b \\
11+
% comment
12+
c = d
13+
\end{equation}
14+
15+
\end{document}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\documentclass{minimal}
2+
\begin{document}
3+
4+
\begin{flushleft}
5+
% this comment IS indented like line below
6+
Hello world!
7+
\end{flushleft}
8+
9+
\begin{equation}
10+
a = b \\
11+
% comment
12+
c = d
13+
\end{equation}
14+
15+
\end{document}

test/test-indentation/test_tikz_reference.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
\begin{tikzpicture}
1111
\draw [solid] let \p{I} = (0,0) in (1,1) -|
1212
(\x{I}-1cm,-1cm) node [yshift=-.25cm] {(i)};
13-
% Just some comment
13+
% Just some comment
1414
\end{tikzpicture}
1515

1616
\begin{tikzpicture}
17-
% (i) center contact head
17+
% (i) center contact head
1818
\draw [solid] let \p{I} = (centerContactHead) in (centerContactHead) -|
1919
(\x{I}-.75cm,-2.5)
2020
node [yshift=-.25cm] {(i)};
2121

22-
% (ii) outer conductor of the contact head
22+
% (ii) outer conductor of the contact head
2323
\coordinate (outerContactHead) at (.8,-1.7);
2424
\draw [solid] let \p{O} = (outerContactHead)
2525
in (outerContactHead) -- (\x{O},-2.5)

0 commit comments

Comments
 (0)