Fixed #613: Add option for indent on &s
This commit is contained in:
parent
4dda0dc03a
commit
404061ff99
@ -586,6 +586,13 @@ Options~
|
|||||||
|
|
||||||
Default value: ['document']
|
Default value: ['document']
|
||||||
|
|
||||||
|
*g:vimtex_indent_on_ampersands*
|
||||||
|
By default, vimtex will align on ampersands e.g. in math aligned
|
||||||
|
environments or in tabular environments. If this feature is not wanted it
|
||||||
|
may be disabled through this option.
|
||||||
|
|
||||||
|
Default value: 1
|
||||||
|
|
||||||
*g:vimtex_index_hide_line_numbers*
|
*g:vimtex_index_hide_line_numbers*
|
||||||
If enabled, then line numbers will be hidden in the index windows. That is,
|
If enabled, then line numbers will be hidden in the index windows. That is,
|
||||||
|nonumber| and |norelativenumber| will be set locally.
|
|nonumber| and |norelativenumber| will be set locally.
|
||||||
@ -1763,6 +1770,7 @@ Associated settings:
|
|||||||
|g:vimtex_indent_enabled|
|
|g:vimtex_indent_enabled|
|
||||||
|g:vimtex_indent_bib_enabled|
|
|g:vimtex_indent_bib_enabled|
|
||||||
|g:vimtex_indent_ignored_envs|
|
|g:vimtex_indent_ignored_envs|
|
||||||
|
|g:vimtex_indent_on_ampersands|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SYNTAX HIGHLIGHTING *vimtex-syntax*
|
SYNTAX HIGHLIGHTING *vimtex-syntax*
|
||||||
|
@ -38,7 +38,8 @@ function! VimtexIndent(lnum) " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Align on ampersands
|
" Align on ampersands
|
||||||
if l:line =~# '^\s*&' && l:prev_line =~# '\\\@<!&.*'
|
if get(g:, 'vimtex_indent_on_ampersands', 1)
|
||||||
|
\ && l:line =~# '^\s*&' && l:prev_line =~# '\\\@<!&.*'
|
||||||
return indent(a:lnum) + match(l:prev_line, '\\\@<!&') - stridx(l:line, '&')
|
return indent(a:lnum) + match(l:prev_line, '\\\@<!&') - stridx(l:line, '&')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -244,6 +244,34 @@ Expect tex (Verify):
|
|||||||
\end{aligned}
|
\end{aligned}
|
||||||
\end{equation}
|
\end{equation}
|
||||||
|
|
||||||
|
Given:
|
||||||
|
Execute (let g:vimtex_indent_on_ampersands = 0):
|
||||||
|
let g:vimtex_indent_on_ampersands = 0
|
||||||
|
|
||||||
|
Given tex (Indent: ampersands 2):
|
||||||
|
\begin{equation}
|
||||||
|
\begin{aligned}
|
||||||
|
1 &
|
||||||
|
& 2 \\
|
||||||
|
3 &
|
||||||
|
& 4 \\
|
||||||
|
\end{aligned}
|
||||||
|
\end{equation}
|
||||||
|
|
||||||
|
|
||||||
|
Do (Indent):
|
||||||
|
gg=G
|
||||||
|
|
||||||
|
Expect tex (Verify):
|
||||||
|
\begin{equation}
|
||||||
|
\begin{aligned}
|
||||||
|
1 &
|
||||||
|
& 2 \\
|
||||||
|
3 &
|
||||||
|
& 4 \\
|
||||||
|
\end{aligned}
|
||||||
|
\end{equation}
|
||||||
|
|
||||||
Given tex (Indent: ignored environments):
|
Given tex (Indent: ignored environments):
|
||||||
\documentclass{minimal}
|
\documentclass{minimal}
|
||||||
\usepackage{amsmath}
|
\usepackage{amsmath}
|
||||||
@ -273,4 +301,5 @@ Expect tex (Verify):
|
|||||||
Given:
|
Given:
|
||||||
Execute (unlet g:vimtex_indent_ignored_envs):
|
Execute (unlet g:vimtex_indent_ignored_envs):
|
||||||
unlet g:vimtex_indent_ignored_envs
|
unlet g:vimtex_indent_ignored_envs
|
||||||
|
unlet g:vimtex_indent_on_ampersands
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user