David Liang wrote:
> I'm not trying to change any mappings when I switch filetypes.
> Instead, I want to define a set of alternate mappings unique to the
> filetype which I can later switch to by calling SetAltMaps().
>
>
> On Nov 11, 2:53 am, StarWing <[EMAIL PROTECTED]> wrote:
>   
>> just define it in your vimrc, or in ftplugin file.an you can call the
>> function in autocmd.
>>
>> On 11ÔÂ11ÈÕ, ÏÂÎç5ʱ47·Ö, David Liang <[EMAIL PROTECTED]> wrote:
>>
>>     
>>> Hi all,
>>> I'm trying to define a different set of alternate maps for different
>>> filetypes. What I'm doing right now is:
>>>       
>>> map <F12>   :call SetAltMaps()<CR>
>>> map <C-F12> :call ResetMaps()<CR>
>>>       
>>> au BufEnter * call ResetMaps()
>>> au BufEnter *    function! SetAltMaps() | map <F1> ... | ... |
>>> endfunction
>>> au BufEnter *.py function! SetAltMaps() | map <F1> ... | ... |
>>> endfunction
>>> au BufEnter *.java ...
>>>       
>>> But it doesn't look like I can define a function in an autocmd this
>>> way. Is there another way to do it?
>>>       
I suggest:

a) in the file .vim/ftplugin/FILETYPE.vim,
b) defining the function
    fun! SetAltMaps()
    ...
   endfun

That way each filetype has its own definition of the SetAltMaps() 
function.  More readable, too.

Regards,
Chip Campbell


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

Reply via email to