# How can I quickly type a LaTeX accent in vim?

I want to write some text in Spanish in which accents are used frequently, such as ó for which I have to write \'{o}. I have seen that in vimtex they have defined for example a to convert into \alpha in math mode, but in normal mode I would like to convert it to for example à.

I also tried the command :ab 'o \'{o} but this only works with whole words, so not when it is part of a word. The same problem occurs when using snippets with UltiSnips.

How can I easily and quickly type an accented letter?

• for what its worth: you dont have to write the braces – Bort May 27 '16 at 12:57
• You could just write ó and tell latex which encoding you are using, such as \usepackage[utf8]{inputenc} you do not have to use the ascii markup for accents unless you want to. – David Carlisle May 27 '16 at 12:58
• Ok thank you Bort and @David, that is even easier! – agold May 27 '16 at 13:09

You could just write ó and tell latex which encoding you are using, such as

\usepackage[utf8]{inputenc}


you do not have to use the ascii markup for accents unless you want to.

• I knew you liked answering vim questions :) – cmhughes May 27 '16 at 13:22
• You don't have to use accent commands, and you shouldn't if you want hyphenation, right? Or am I living in the 20th century? – Gilles 'SO- stop being evil' May 27 '16 at 13:46
• @Gilles: I got a conference template with these accent commands, therefore I thought it would be necessary. – agold May 27 '16 at 14:10
• @Gilles even in the 20th century it made no difference to the typeset result whether you use \'o or ó (you do want to use T1 font encoding in either case to get hyphenation (\usepackage[T1]{fontenc}) – David Carlisle May 27 '16 at 15:14
• @agold if you have a keyboard like mine without the accented letters it's still easier to type \'o than remember what arcane combination of keystrokes produces ó – David Carlisle May 27 '16 at 15:16

For what it's worth you could achieve this with:

:imap 'o \'{o}
`