Subject: Re: mapping mess - <leader> g:foo options etc To: vim_dev@googlegroups.com Cc: Bcc: -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- On 25-Jan-2012 19:45:27 +0100, Marc Weber wrote:
> What about reworking the way users can customize plugin mappings? > > How can you customize mappings today? > > 1) <leader> > Example: > inoremap <leader>foo > > problem: You have to set leader before you use a plugin <Leader> is just a symbolic identifier for one of the (very few) available keys for custom mappings. You can set it to your preference (some use "," instead of "\"), but it's meant to be fixed. > 2) g:x setting > Example: > if !exists('g:my_plugin_map_prefix') > let g:my_plugin_map_prefix = '\f' > endif > exec 'noremap '.g:my_plugin_map_prefix.'bar' :call ... Some plugins allow to redefine the map-prefix, as this is helpful when the plugin offers many (similar and related) mappings, and users typically just want to customize the prefix, and the global config variable allows to do this in one fell swoop. But this is just optional syntactic sugar for the canonical way to customize plugin mappings: > Did I miss something? Neither is friendly to users and plugin authors > How could it be improved? :help using-<Plug> Most plugins offer <Plug>-mappings, and you can map your own keys to it (or keep the default mappings that the plugin provides). If you happen upon a plugin that simply does something like this: nnoremap <C-x><C-p> :call <SID>MyFunc()<CR> Kindly ask the plugin author to change it into this: nnoremap <silent> <Plug>(PluginNameMappingName) :call <SID>MyFunc()<CR> if ! hasmapto('<Plug>(PluginNameMappingName)', 'n') nmap <C-x><C-p> <Plug>(PluginNameMappingName) endif -- regards, ingo -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php