[Tex/LaTex] Shortcut for inserting matching \end{something} in VIM

auto-completionvimvim-latex

I remember some time ago I always used a shortcut in VIM that allowed me to type this (<X> is indication of the location of the cursor):

... rest of document ...

\begin{<ENVIRONMENT>}
  some text
  more text
<X>

... document continues ....

and then I would key in some shortcut at the location of <X> and the matching \end{<ENVIRONMENT>} would be inserted:

... rest of document ...

\begin{<ENVIRONMENT>}
  some text
  more text
\end{<ENVIRONMENT>}

... document continues ....

Here, of course, <ENVIRONMENT> can be anything, like align or itemize.

I know about VIM's <C-x> + <C-p>, <C-x + <C-n> and <C-x> + <C-o>. The last one works very well for closing HTML tags, but it doesn't work in LaTeX.

I forgot what it was and I hope someone here knows it. It might have been a plugin but I don't think so. If anyone can tell me what it is, I will be forever grateful.

EDIT:
Of course I am using LaTeX-Suite (or vim-latex, wish they'd stick to a name).

Best Answer

When using VimTeX, you can type ]] in insert mode to close the current environment.