* Andy Wokula <[email protected]> [100203 06:04]:
> Am 03.02.2010 07:32, schrieb John Magolske:
>> 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>"?
>
> :h <lt>
> :map <leader>ts :let SuperTabMappingForward = '<lt>leader><lt>space>'<CR>
Thanks, this <lt> is a good trick to know. It turns out that as pansz
suggested, using a function is the way to go. I'd already tried that,
but my previous attempt at scripting a solution wasn't working...which
I thought had to do with <leader> <space> <tab> etc being converted.
But now I see how functions behave differently in this regard. My
problem had to do with a stupid oversight -- I was doing:
let SuperTabMappingForward = "<leader><space>"
Rather than properly setting a global variable like:
let g:SuperTabMappingForward = "<leader><space>"
And now it works. Using SuperTab to tab-complete with the <tab> key
in insert mode is handy, but I prefer to explicitly set & unset that
functionality:
" SuperTab -- set default tab completion key to be <leader><space>
" and allow the ability to toggle between that sequence and simply
" using the <tab> key:
let SuperTabMappingForward = '<leader><space>'
let g:SuperTab_tab = 0
function! ToggleSuperTabMap()
if g:SuperTab_tab == 1
let g:SuperTabMappingForward = "<leader><space>"
let g:SuperTabMappingTabLiteral = "<tab>"
so ~/.vim/plugin/supertab.vim
let g:SuperTab_tab = 0
echo "SuperTab key = <leader><space>"
else
let g:SuperTabMappingForward = "<tab>"
let g:SuperTabMappingTabLiteral = "<leader><space>"
so ~/.vim/plugin/supertab.vim
let g:SuperTab_tab = 1
echo "SuperTab key = <tab>"
endif
endfunction
map <leader><tab> :call ToggleSuperTabMap()<CR>
imap <leader><tab> <esc>:call ToggleSuperTabMap()<CR>a
Regards,
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