1

Concerning indent in vimtex, it has some settings controlling indenting of delimiters, the option seems to be g:vimtex_indent_delims. However, I would like to not only indent the text between opening and closing braces, but also the braces themselves, leading to a layout like

\cs_new:Npn \__hook_parse_dot_label:n #1
  {
    \tl_if_empty:nTF {#1}
      {
        \msg_expandable_error:nn { hooks } { empty-label }
        \__hook_currname_or_default:
      }
      {
        \str_if_eq:nnTF {#1} { . }
          { \__hook_currname_or_default: }
          { \__hook_parse_dot_label:w #1 ./ \s__hook_mark }
      }
  }

(this is example code taken from the lthooks package.) So additional to the usual indenting of the lines in the {...} block, also the braces themselves should be indented.

From what I can see, there is, however, no such option in g:vimtex_indent_delims.

How can I achieve such an indent in vimtex? Is there some other place in the documentation with aprropriate settings you can refer me to?

2
  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Commented Jan 14, 2022 at 19:33
  • I would add that using = is lacking in general. Perhaps there is a plugin.
    – eyal karni
    Commented Jan 16, 2022 at 1:01

1 Answer 1

1

From what I can see, there is, however, no such option in g:vimtex_indent_delims.

Correct. VimTeX does not support this style of indentation. There is a semi related option g:vimtex_indent_delims.close_indented that allows to keep the closing delimiter indented, but there is no option to add indent to the opening delimiter.

I do not plan to add support for this, either. I find it quite hard to write good and robust indentation scripts, and I believe the current indentation of VimTeX is quite good and robust. Adding support for what you ask for would possibly be very hard to do in a robust manner. Feel free to prove me wrong by submitting a pull request with a proof of concept - I'll be happy to accept it if I believe it works well without breaking any current behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.