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']
|
||||
|
||||
*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*
|
||||
If enabled, then line numbers will be hidden in the index windows. That is,
|
||||
|nonumber| and |norelativenumber| will be set locally.
|
||||
@ -1763,6 +1770,7 @@ Associated settings:
|
||||
|g:vimtex_indent_enabled|
|
||||
|g:vimtex_indent_bib_enabled|
|
||||
|g:vimtex_indent_ignored_envs|
|
||||
|g:vimtex_indent_on_ampersands|
|
||||
|
||||
==============================================================================
|
||||
SYNTAX HIGHLIGHTING *vimtex-syntax*
|
||||
|
@ -38,7 +38,8 @@ function! VimtexIndent(lnum) " {{{1
|
||||
endif
|
||||
|
||||
" 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, '&')
|
||||
endif
|
||||
|
||||
|
@ -244,6 +244,34 @@ Expect tex (Verify):
|
||||
\end{aligned}
|
||||
\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):
|
||||
\documentclass{minimal}
|
||||
\usepackage{amsmath}
|
||||
@ -273,4 +301,5 @@ Expect tex (Verify):
|
||||
Given:
|
||||
Execute (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