2013-02-06 10 views
10

Quando si preme d in vim la mia riga di stato dice d e attende infinitamente ulteriori istruzioni.Come disabilitare il timeout sul tasto vim leader?

Quando premo il mio leader (, per me), attende l'input per un po 'e quindi scade.

Come disattivare questa funzionalità e attendere per un tempo indefinito ulteriori istruzioni?

+1

': help 'ttimeout'' può essere utile. –

+0

@AntonKovalenko: ci sono degli effetti collaterali che devo sapere quando si cancella il timeout? Anche la distinzione tra 'timeout' e' ttimeout' non mi è chiara, dopo aver letto la pagina di aiuto. – orlp

+0

Fondamentalmente, ESC è un "leader" per le frecce e altre sequenze di controllo, quindi potrebbe essere necessario premere ESC due volte anziché una volta. (Potrebbe esserci un modo per aggirarlo, ma sono troppo pigro per leggere oltre - ecco perché ho appena dato un suggerimento invece di postare una risposta) –

risposta

10

Da :help ttimeout:

       'timeout' 'to' 'notimeout' 'noto' 
'timeout' 'to'   boolean (default on) 
         global 
               *'ttimeout'* *'nottimeout'* 
'ttimeout'    boolean (default off) 
         global 
         {not in Vi} 
     These two options together determine the behavior when part of a 
     mapped key sequence or keyboard code has been received: 

     'timeout' 'ttimeout'    action 
      off   off     do not time out 
      on   on or off    time out on :mappings and key codes 
      off   on      time out on key codes 

     If both options are off, Vim will wait until either the complete 
     mapping or key sequence has been received, or it is clear that there 
     is no mapping or key sequence for the received characters. For 
     example: if you have mapped "vl" and Vim has received 'v', the next 
     character is needed to see if the 'v' is followed by an 'l'. 
     When one of the options is on, Vim will wait for about 1 second for 
     the next character to arrive. After that the already received 
     characters are interpreted as single characters. The waiting time can 
     be changed with the 'timeoutlen' option. 
     On slow terminals or very busy systems timing out may cause 
     malfunctioning cursor keys. If both options are off, Vim waits 
     forever after an entered <Esc> if there are key codes that start 
     with <Esc>. You will have to type <Esc> twice. If you do not have 
     problems with key codes, but would like to have :mapped key 
     sequences not timing out in 1 second, set the 'ttimeout' option and 
     reset the 'timeout' option. 

     NOTE: 'ttimeout' is reset when 'compatible' is set. 

Dai commenti:

In sostanza, ESC è un "leader" per le frecce e altre sequenze di controllo, per cui si potrebbe essere necessario premere ESC due volte invece di una volta . - @Anton Kovalenko

In esecuzione set notimeout e set ttimeout risolto i miei problemi. - @nightcracker

+1

Potete fornire alcune spiegazioni sul perché è meglio impostare ttimeout invece di timeout o timeoutlen, per favore? – aturegano

Problemi correlati