Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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).

share|improve this question
    
I'm not referring to that, but nice to know, it's basically as useful as what I'm looking for, thank you! –  pancake Jul 4 '12 at 19:04
2  
Perhaps you are thinking of the closeb script. –  Aditya Jul 4 '12 at 22:17
1  
Tested the closeb script, works very well. –  Rmano Feb 4 at 0:22
add comment

1 Answer

Something that is pretty much as useful is to type nameofenvironment then F5 which gives

\begin{nameofenvironment}

\end{nameofenvironment}<++>

and puts the cursor in the body of the environment. You can leave the environment easily by pressing CTRL J

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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