On 01/07/09 23:54, Paul wrote:
>
> The familiar way of searching is to type /string<Enter>
>
> Not bad, but I am wondering if, instead of hitting Enter at the end of
> the search string, a timeout instead could signal that I've finished
> my input. Say, I type /string then wait 1 second, then hit dw. Instead
> of those two characters being appended to my search string, it would
> be executed as a delete command.
>
> Not to every user's taste, I'm sure, but would something like that be
> possible to script?

IIUC, Vim can use keyboard buffering: keys you hit will be acted on in 
due time, even if you don't see them immediately. For instance, in a Vim 
session with many mappings and complex keymaps, you can sometimes type 
faster than your keys are taken up; but if you go on typing (in Insert 
mode, say), what you type will end up in the file.

Similarly, IIUC if you type daw _immediately after_ hitting Enter on a 
search command, then (assuming a slow search on a large file) Vim will 
"delete a word" wherever the cursor ends up at the end of the search. 
Not for the faint-hearted, and be ready to hit u (undo) if it doesn't 
delete what you thought it would.

Or, if you want to _cancel_ the search, hit Esc _instead_ of Enter. Then 
daw will delete a word wherever the cursor is now.


AFAICT, the CursorHold / CursorHoldI events are not triggered in 
command-line mode (i.e. while inputting a search command or an 
ex-command), so I don't think you could program Vim to auto-accept 
without waiting for your Enter or Esc whenever you stop for more than 
one second while inputting a search or ex command. And IMHO, even if 
such auto-accept (or auto-cancel) would be possible, it would be more of 
an annoyance than a help.

(How do I know they aren't? My homewritten colorscheme includes an 
autocommand to change the statusline colour whenever CursorHold or 
CursorHoldI is triggered.)


Best regards,
Tony.
-- 
Chisolm's First Corollary to Murphy's Second Law:
        When things just can't possibly get any worse, they will.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to