Tuesday, June 29, 2010

Re: Conditional imap

On Tue, June 29, 2010 9:22 am, gitterrost4 wrote:
> I did what you told me to (i dont want to use "(<Tab>" but just "(" to
> remap
> to "\left("). When I enter the command while i opended the Document
> everything works fine. But when I put the command in my .vimrc (or the
> tex.vim respectively) it stops working.

So when you enter a "(" in insert mode, vim enters the "(" or what are
you expecting? The mapping might not be active or vim doen't recognize
the math-mode.

Please show us the output of:
:verbose imap (
You can do this, by issuing:
:redir @+
:verbose imap (
:redir end
and pasting your clipboard into your mail. If this doesn't output the
mapping that was given, it might be, that some plugin (maybe Latexsuite
?) overrides your mapping.

If you want that mapping only for latex documents, I suggest, that you
put it into a filetype specific file. Create a file
~/.vim/ftplugin/tex.vim (This is for Unix, create Directories that don't
exist yet, for Windows, you can use $HOME/vimfiles/ftplugin/tex.vim) and
in that file you write your mapping. Note, that you probably want to
change the map to be buffer-local, so that in only applies to TeX-files.

To do that change the map to something like this:
imap ( <expr> <buffer> …

If you want to make sure, that no plugin overrides the mapping, you
could place the file tex.vim also below ~/.vim/after/ftplugin/ for Unix
and $HOME/vimfiles/after/ftplugin/ for Windows. That way, it will be
applied last overriding any setting that might have been applied by a
global or filetype plugin.

It might also be, that the math-mode is not correctly
recognized. To find out, what the name of the syntax highlighing for the
math mode is, put the cursor on the math-mode and issue:
:echo synIDattr(synID(line('.'),col('.'),1), "name")

This should output something like texMathSomething. In case it is
something different, you need to adjust your mapping.

Oh and please don't top post. It is general list consensus to trim
quotes and reply inline.

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