hi;
I regularly use LaTeX and accented characters. I used to have commands
like
:ino 'a \'a
in order to write accents in TeX. The first problem is that it is not so
nice to read a file full of these tex commands. The second, and main,
problem, is that vim's dictionary does not see, say, "aqu\'{\i}" as
"aquí", and therefore it hilights it as mispelled. So I thought on using
autocmd's to change the text. Basically, I have these commands in my
.vimrc

-------------------- excerpt of .vimrc -----------------
augroup acentos
        autocmd!
        autocmd BufReadPost *.tex call Acentua()
        autocmd BufWritePre *.tex exe "normal mm" | call Desacentua()
        autocmd BufWritePost *.tex call Acentua() | exe "normal `m"
augroup END

fun! Acentua()
        silent exe "%s/\\\\'a/á/ge"
        silent exe "%s/\\\\'e/é/ge"
        .... etc ....
endfun

fun! Desacentua()
        silent exe "%s/á/\\\\'a/ge"
        silent exe "%s/é/\\\\'e/ge"
        .... etc ....
endfun
-------------------- end of excerpt --------------------

Basically, under a saving it converts everything to TeX's way, saves it,
and then converts everything back to normal.
I know there are ways to use utf-8 or latin1 characters in TeX files,
but I prefer to stick to these mappings for portability reasons.

So far, so good. Now I have two problems:

1) the substitutions in the functions Acentua and Desacentua are saved
as changings. So undo commands mess with them. I'd like those changings
not to be seen by undo/redo commands. Is it possible?

2) Although I put a mark on the line I am at, and then go back to it in
BufWritePost, sometimes the window scrolls a few lines, which is not
very nice. Is it possible to save the first line appearing in the
window, and, at the end of the saving process, end up seeing exactly the
same lines I was seeing before?

Thanks in advance,
-- 
Matías Graña
[EMAIL PROTECTED]

Reply via email to