Tuesday, June 29, 2010

Re: Conditional imap

Hi gitterrost4!

On Di, 29 Jun 2010, gitterrost4 wrote:

> 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(" : "(" : "("

Ok, I admit, I don't understand, why you need to check for 3 columns in
front of the cursor. But hey, if it works, I won't complain ;)

regards,
Christian
--

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