2

I am a long term Vim user but I consider switching to Emacs + EVil-mode. However, there is one major obstacle. I most frequently use Vim to edit LaTeX files and I have grown quite accustomed to the LaTeX macros of Vim-LaTeX-Suite.

E.g. typing EIT automatically turns into

\begin{itemize}
   \item <++>
\end{itemize}   

typing ``8 or `/ turns into

\infty  or  \frac{<++>}{<++>}  

This actually depicts 2 issues.

1) Automatic replacement of strings (EIT; ``8) with the corresponding environment; LaTeX macro. It would be great if someone could point me to some tutorial. I think it should be fairly easy to solve with some kind of a replacement dictionary.

2) The <++> tags are jump marks. Hitting CTRL+J in Vim makes the cursor jump to the next jump mark in the text. This makes navigating automatically inserted environments and formulae very quick and easy. Is there any way to emulate this behavior?

3) When writing braces {} these braces become substituted by {}<++> and the cursor jumps back in between the braces. I type my formula and CTRL+J jump behind the braces. Therefore I am now used to closing my braces first and typing the respective content afterwards. Anyway to get this behavior?

  • Regarding point 1), AUCTeX has this behavior with C-c C-e itemize RET, but I don't know how to integrate this with Evil. – giordano Oct 22 '15 at 12:06
  • Works pretty good with YAsnippet. Will be a bit relearning, but is manageable. – cataclysmic Oct 23 '15 at 17:34
  • Yasnippet doesn't provide all advanced features AUCTeX gives you when inserting environments and macros (like autocompletion for many arguments), I think it's useless to activate it and don't use its features. – giordano Oct 23 '15 at 22:12
  • Have to look through AUCTeX macros. But the issue is simply that I am used to the LaTeX-Suite way of doing things. – cataclysmic Oct 24 '15 at 12:53
2

1) The most basic facility for this would be abbrevs. They correspond to Vim's abbreviations, but are in so far different that you need to enable abbrev-mode first and can define mode-specific abbrevs. I'd use these for correcting typos, expanding acronyms and other basic expansions.

2) I haven't heard of C-j for this purpose before, must be something specific to that plugin. My approach to this would be different, I'd use an advanced snippet system like Yasnippet which supports template expansion reminiscent of Sublime Text and Textmate, including their feature of jumping to fields inside the template for filling out subparts easily.

3) Management of delimiters is generally done with something like paredit or smartparens and would allow you to do things like automatic pairing, moving beyond limiters and much more.

  • Thank you for those hints. I'll take a look at those packages. Those solutions all sound promising. – cataclysmic Oct 22 '15 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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