The Puma
The Puma

Reputation: 1390

In vimscript, how would you set a timeout after user input (in cntrl-p plugin)?

I love the plugin Cntrl-P, but sometimes it's really slow and does some stupid decision making. So I wanted to edit the plugin. Basically, I want to limit when it searches. To do this, I wanted to set a timeout for around 50 milliseconds before searching after input. Also, I want to disable search when a backspace is entered.

A little digging around and searching the internet did nothing for me, so hopefully there are some gurus here who know exactly how to do this.

Thanks!

Upvotes: 0

Views: 415

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172590

As mentioned in the comments, you should collaborate with the plugin's author to try to achieve this. Maintaining a fork is a lot of work and with the fragmentation of the user base, you're hurting all plugin users (who now have to decide which feature set to use).

Any sort of timeout will be difficult to implement. In pure Vimscript, this is close to impossible, as most functions (like glob(), which may be used by CtrlP to retrieve a list of files) are not interruptible; Vimscript is single-threaded. The only option is to split the work passed to the function into smaller chunks. The same applies to external commands, too.

Upvotes: 1

Related Questions