Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have mappings within my .vimrc to open or switch to commonly used applications.

Use Case: I have 10 open applications and I'm in MacVim. It's faster to issue <Leader>sc which is mapped to map <Leader>sc :silent !open /Applications/Google\<CR>, than to Command+Tab several times to get to the Chrome app.

However, there is a delay by vim from the time I issue <Leader>sc to when it executes the action.

How can I reduce this delay just for this mapping? I'd like this to be as instantaneous as running open /Applications/Google\ from the command line, however vim introduces a slight delay before it executes that command.

Edit: I noticed there is a timeoutlen setting, however that is global. I'd like something similar just for these mappings.

share|improve this question

This is most likely because you have another mapping that begins with <Leader>sc and Vim is waiting to see if you are just typing the shorter mapping, or intend to type the other, longer mapping.

The only way around this problem is to change one of the mappings so Vim knows there is no ambiguity, which should cause it to instantly run the command.

Typing ":map <leader>sc" and pressing enter should show you all mappings that start with that sequence.

share|improve this answer
I checked and the only mapping is the one I had defined. – Jey Balachandran Apr 14 '12 at 21:25
Then all I can suggest is to move things from your Vim configuration out of the way until you no longer have a delay. Is this console Vim or gVim? (Both?) – Heptite Apr 14 '12 at 22:29

You can't adjust timeoutlen for specific commands/mappings in Vim. You could probably do that for a specific buffer/window/tab but it would still be the same value for any command/mapping in that specific context.

But I think that the delay is caused by the use of open here.

Why don't you use Quicksilver? I've used it for years: it provides the same mechanism whatever context I happen to be in. Whether I'm in Vim, iTunes, Outlook or Preview I can type the exact same key sequence to switch to Chrome. This ubiquity alone makes it a must have for me. That and the speed of <C-Space>c<CR>.

In your system, you could theoretically save time when doing Vim > Chrome but how do you do Chrome > Vim? AFAIK you can't use <leader>sv in Chrome so you must resort to another mechanism. That's at least two systems to setup and maintain or at least a custom very effective one and a default less effective one.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .