Tuesday, February 2, 2010

A mapping to remap a mapping (but & are interpreted literally)

I'm trying to create a mapping that changes another mapping:

map <leader>ts :let SuperTabMappingForward = '<leader><space>'<CR>

But the second <leader> in that line gets interpreted as the literal
mapleader character. Is there some way to escape it? Or perhaps a
different means of inputting "<leader>"?

This is for the SuperTab plugin, where the SuperTabMappingForward
variable changes the key used for completion. I can input the
following on the command line manually:

:let SuperTabMappingForward = '<leader><space>'
:let g:SuperTabMappingTabLiteral = '<tab>'
:so ~/.vim/plugin/supertab.vim

And that works -- pressing the leader key followed by the space key
causes completion, and the tab key is returned to just inputing tabs.
But when those lines are mapped into my vimrc, <leader> and <tab> get
interpreted like so (my mapleader character is `):

:let SuperTabMappingForward = '` '
:let g:SuperTabMappingTabLiteral = '^I'

The goal is to have a key sequence that will remap on-the-fly the key
SuperTab uses for tab completion.

TIA for any suggestions,

John


--
John Magolske
http://B79.net/contact

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment