All,

I've got several two-key global mappings for the CtrlP plugin:

  nnoremap <C-P><C-O> :<C-U>CtrlPBuffer<CR>
  nnoremap <C-P><C-P> :<C-U>CtrlP<CR>
  [...]

These mappings interact with plugins that provide buffer-local
mappings that are prefixes of these multi-key mappings.  For
example, the Tagbar plugin defines a normal-mode buffer-local
mapping for CTRL-P.

The problem is that when I press CTRL-P in the Tagbar window,
Vim assumes that it might be the prefix for the global mappings
for CtrlP, so it waits for 'timeoutlen' before deciding to
invoke the single-key buffer-local mapping for Tagbar.  Because
my preferred 'timeoutlen' is three seconds, this renders the
buffer-local mapping essentially useless for me.

My current work-around is to map the key CTRL-P to a prefix,
then combine that prefix with other keys to make the final
mappings, something like this:

  nmap      <C-P>             <SID>CtrlP
  nnoremap  <SID>CtrlP<C-O>   :<C-U>CtrlPBuffer<CR>
  nnoremap  <SID>CtrlP<C-P>   :<C-U>CtrlP<CR>

This way, Vim won't see any multi-key mappings that begin with
CTRL-P, so a buffer-local mapping of CTRL-P will execute without
waiting for 'timeoutlen'.

Is there a better way to handle this problem in general?  I
don't see a way to "unmap" the global mappings on a per-buffer
basis, and I'd like to keep the global mappings in-place for
most buffers while Tagbar is running so globally unmapping when
Tagbar opens and restoring when it closes doesn't quite fit the
bill, either.

Thanks,
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

Reply via email to