On 28/05/08 11:51, Antony Scriven wrote:
> 2008/5/28 Andy Wokula<[EMAIL PROTECTED]>:
>
>   >  Antony Scriven schrieb:
>   >  >  Hi all. I've often encountered the situation where a plugin
>   >  >  maps keys that I've wistfully mapped in my vimrc. I think it
>   >  >  would be useful for a user to be able to prevent this, say
>   >  >  by using a notation such as
>   >  >
>   >  >     :map<final>  \x foo
>   >  >
>   >  >  Then if Vim tries to map \x elsewhere, the command is ignored.
>   >  >  Comments? --Antony
>   >
>   >  You can put your mappings in a
>   >     ~/.vim/after/plugin/vimrc.vim
>   >  or define a function triggered by the VimEnter autocmd.
>   >  Thus you get again the last word on your mappings.
>
> That only works for some cases. Ftplugins? --Antony

ftplugins should only have ":map <buffer>" (and similarly ":setlocal" 
etc.) to avoid clobbering mappings for other buffers; and you can always 
(once you know about them, which may be as simple as using ":verbose map 
{lhs}" and/or ":verbose map! {lhs}", in both cases with the appropriate 
{lhs}) override them in an "after-plugin", i.e., a user-written ftplugin 
in the corresponding |after-directory|.

You could even use

        :       au VimEnter * au FileType * map <buffer> {lhs} {rhs}

-- using the VimEnter autocommand event (which is triggered after all 
global plugins have been run) to set up a FileType autocommand (which 
will thus be triggered after all other FileType autocommands, including 
the one which sources the filetype-plugin).


Best regards,
Tony.
-- 
If you don't get everything you want, think of
everything you didn't get and don't want.

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

Raspunde prin e-mail lui