From f9d07de70711933337a224d8c2e3623da5127701 Mon Sep 17 00:00:00 2001 From: BertrandSim <46756885+BertrandSim@users.noreply.github.com> Date: Fri, 29 Oct 2021 17:51:47 +0800 Subject: [PATCH 1/2] indentkeys autoindent only at start of line This PR prefixes the 'indentkeys' `(,),],},\item,\else,\fi` with a `0`. The effect is that these indent keys only autoindent the line when they are typed at the start of the line (see `:h i_CTRL-F`). ie. no autoindenting when typing a closing `),],}` mid-way through a statement. (The assumption here is that one would *not* want an autoindent when, say, is in the midst of a long equation, but only to autoindent when closing an existing block). --- indent/tex.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/tex.vim b/indent/tex.vim index a52ed5d606..b1ff961f6f 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -20,7 +20,7 @@ set cpoptions&vim setlocal autoindent setlocal indentexpr=VimtexIndentExpr() -setlocal indentkeys=!^F,o,O,(,),],},\&,=\\item,=\\else,=\\fi +setlocal indentkeys=!^F,o,O,0(,0),0],0},\&,0=\\item,0=\\else,0=\\fi " Add standard closing math delimiters to indentkeys for s:delim in [ From 9f39ccf3780b9375788d1742ef3877fbd1e4ca00 Mon Sep 17 00:00:00 2001 From: BertrandSim <46756885+BertrandSim@users.noreply.github.com> Date: Fri, 29 Oct 2021 17:55:29 +0800 Subject: [PATCH 2/2] autoindent only at start of line for delims --- indent/tex.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/tex.vim b/indent/tex.vim index b1ff961f6f..cd116f4afe 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -25,7 +25,7 @@ setlocal indentkeys=!^F,o,O,0(,0),0],0},\&,0=\\item,0=\\else,0=\\fi " Add standard closing math delimiters to indentkeys for s:delim in [ \ 'rangle', 'rbrace', 'rvert', 'rVert', 'rfloor', 'rceil', 'urcorner'] - let &l:indentkeys .= ',=\' . s:delim + let &l:indentkeys .= ',0=\' . s:delim endfor