Tuesday, June 29, 2010

Re: Conditional imap

Indeed it was latex-suite overriding the map from my tex.vim file. I fixed
this by appending the line

exe 'source '.fnameescape('~/.vim/ftplugin/tex.vim')

to the file $VIM/ftplugin/latex-suite/main.vim

I do not know, if this could be solved better, but now it works...

I also had to adapt the matching, because your suggestion would only match
if the cursor was between math characters, but not if the cursor was at the
end of the line or after a math delimiter. It now boiled down to:

inoremap <expr> ( synIDattr(synID(line('.'), col('.')-1, 1),
"name")=~"texMath" ? "\\left(" : synIDattr(synID(line('.'), col('.'), 1),
"name")=~ "texMath" ? "\\left(" : synIDattr(synID(line('.'), col('.')-1, 1),
"name")=~"Delimiter" ? synIDattr(synID(line('.'), col('.')-2, 1),
"name")=~"Delimiter" ? synIDattr(synID(line('.'), col('.')-3, 1),
"name")!~"texMath" ? "\\left(" : "(" : synIDattr(synID(line('.'),
col('.')-2, 1), "name")!~"texMath" ? "\\left(" : "(" : "("


Thanks for helping :)
--
View this message in context: http://old.nabble.com/Conditional-imap-tp29008528p29022437.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment