问题 如何禁用vim领导键的超时?


当我按下 d 在vim我的状态线说 d 并无限期地等待进一步的指示。

当我按下我的领导时( 对我来说,它等待输入一段时间然后超时。

如何禁用此功能,并使其无限期等待进一步的说明?


3113
2018-02-06 19:44


起源

:help 'ttimeout' 可能很有用。 - Anton Kovalenko
@AntonKovalenko:清除超时时,我必须知道任何副作用吗?也是区别 timeout 和 ttimeout 在阅读帮助页面后,我不清楚。 - orlp
基本上,ESC是箭头和其他控制序列的“领导者”,因此您可能必须按ESC两次而不是一次。 (可能有一些方法,但我懒得进一步阅读 - 这就是为什么我只是提示而不是发布答案) - Anton Kovalenko
@AntonKovalenko:好吧,跑步 set notimeout 和 set ttimeout 解决了我的问题,如果你把它作为答案添加,你将获得+1并接受答案。 - orlp
@nightcracker:另一个缺点是地图变得烦人 ,x 和 ,xy 同时因为Vim不会看到区别 ,x+y 要么 ,xy。但我不建议以这种方式使用映射。你也可以考虑设置一个高超时。 - Daan Bakker


答案:


: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.

来自评论:

基本上,ESC是箭头和其他控制序列的“领导者”,因此您可能必须按ESC两次而不是一次。 - @Anton Kovalenko

运行 set notimeout 和 set ttimeout 解决了我的问题。 - @nightcracker


11



您可以提供一些解释,为什么更好地设置ttimeout而不是timeout或timeoutlen,好吗? - aturegano