Vimtex: How to add delimiters list for big and bigg

Created on 21 May 2017  路  6Comments  路  Source: lervag/vimtex

We know that vimtex has tsd to toggle of ( and ) between \left( and \right) and so on. I have read the related section g:vimtex_delim_list but still stacked at how to add gtsd to toggle ( and ) between \big( and \big) and ggtsd to toggle ( and ) between \bigg( and \bigg).

Idealy hope this work also for other delimiters like {...} and [...].

I need this mainly because that in the following example of TeX, the \left...\right is not work:

\begin{align*}
0&=\left(\text{first line of formula}\\
  &\qquad\text{the second line of formula}\right)
\end{align*}

Most helpful comment

Ok, so: You want to add two new maps, gtsd and ggtsd. However, there is no "simple" way to do this from vimtex today. However, you can set

    let g:vimtex_delim_toggle_mod_list = [
      \ ['\left', '\right'],
      \ ['\bigl', '\bigr'],
      \ ['\biggl', '\biggr'],
      \]

In order for tsd to toggle between the above modifier variants. With the above setting, this also works for you example TeX input.

All 6 comments

First, \big(...\big) and similar are not really best practice. You should use \bigl(...\bigr). This also makes it possible for vimtex to parse. I'll write a more thorough reply later.

Ok, so: You want to add two new maps, gtsd and ggtsd. However, there is no "simple" way to do this from vimtex today. However, you can set

    let g:vimtex_delim_toggle_mod_list = [
      \ ['\left', '\right'],
      \ ['\bigl', '\bigr'],
      \ ['\biggl', '\biggr'],
      \]

In order for tsd to toggle between the above modifier variants. With the above setting, this also works for you example TeX input.

That is a really great solution!

I'm happy you like it :)

With the above g:vimtex_delim_toggle_mod_list code by @lervag, one can go directly

  • from (a+b) to \bigl(a+b\bigr) with 2tsd, and
  • from (a+b) to \biggl(a+b \biggr) with 3tsd.

Such a great solution/plugin, thanks again for your time on this

Such a great solution/plugin, thanks again for your time on this

Happy you like it! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsbuffalo picture vsbuffalo  路  3Comments

sharethewisdom picture sharethewisdom  路  3Comments

adimanea picture adimanea  路  5Comments

itsShnik picture itsShnik  路  5Comments

ettom picture ettom  路  6Comments