Tuesday, January 15, 2013

Re: Buffer-local unmap of global mapping

On 01/13/2013 04:49 PM, Andy Wokula wrote:
> Several plugins (buffer explorers, file explorers) define a lot of short
> keys (keys like `d' or `y'), but it's awkward to use them because they
> often wait for a longer global sequence (e.g. `ds', `ys' from
> surround.vim).

I run both the bufexplorer and vim-surround plugins, so I've had
to work around the problem you describe. My current solution
for the ``ds`` mapping is:

augroup local_bufExplorer
autocmd!
autocmd BufEnter \[BufExplorer\] unmap ds
autocmd BufLeave \[BufExplorer\] nmap ds <Plug>Dsurround
augroup END

> First idea: add a new buffer-local option that, when enabled, means:
> Only check buffer-local mappings (not global mappings) when waiting
> for a complete left-hand-side.
>
> Using an option, the mechanism could be turned on and off (how would I
> otherwise access a global mapping?);
> (this is opposed to a new mapping modifier (next to <buffer>,
<silent>,...)).

After thinking about this for a while, your idea seems to cover
the problem cases for me. It's hard to pick a good name for the
option, but I think the functionality fixes this problem.

Michael Henry

--
You received this message from the "vim_use" 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

No comments: