Ben Schmidt wrote:
>> 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.
>>     
>
> The problem with this approach is that because functions share a global
> namespace as soon as you edit more than one file at once of different
> types, the functions will clobber each other.
>   
The improved approach is to use  s:SetAltMaps() functions (instead of 
SetAltMaps()) with the local maps you mentioned earlier:

map <buffer> <F12>   :call <SID>SetAltMaps()<CR>
map <buffer> <C-F12> :call <SID>ResetMaps()<CR>

with those maps also residing in .vim/ftplugin/FILETYPE.vim files.  That way 
neither the functions nor the maps occupy global namespace.

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