Loading ...
Sorry, an error occurred while loading the content.

(bug) delay of 1 second after a few commands before screen gets updated

Expand Messages
  • Dominique Pelle
    Hi I ve noticed that a couple of Vim commands have a lag (1 or 2 seconds?) before the screen gets updated. Here is a simple example: 1/ start vim in a
    Message 1 of 5 , Jun 2, 2008
    • 0 Attachment
      Hi

      I've noticed that a couple of Vim commands have a lag (1 or 2 seconds?)
      before the screen gets updated. Here is a simple example:

      1/ start vim in a terminal (not gvim)

      1/ type a line of 50 i with: <esc>50ii<esc>

      2/ notice when pressing the last <esc>, there is a delay
      of 1 to 2 seconds before the characters appear on the screen.

      Other observations

      - bug happens with Vim in a terminal (at least xterm and gnome-terminal)
      - bug does not happen with gvim.
      - bug does not happens with: 'vim -u NONE'
      - bug happens with 'vim --noplugin' and an empty ~/.vimrc
      but no longer happens when I delete the empty ~/.vimrc (which is
      very odd, what's the difference with an empty ~/.vimrc and no ~/.vimrc?)

      Can anybody else reproduce this bug too?

      I'm using Vim-7.1.305 (huge) on Linux x86.

      There are other commands which show the same delay of 1 or 2 seconds
      such as:

      - when changing till end of line with: c$foo<esc>
      - or when inserting something before visual blockwise: <ctrl-v>jjjIfoo<esc>

      -- Dominique

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Brian L. Matthews
      ... I can duplicate it (on Mac OS X with a vim built from source running in a Terminal), but I don t think it s a bug. When running in a terminal, some keys
      Message 2 of 5 , Jun 2, 2008
      • 0 Attachment
        Dominique Pelle wrote:
        > I've noticed that a couple of Vim commands have a lag (1 or 2 seconds?)
        > before the screen gets updated. Here is a simple example:
        >
        > 1/ start vim in a terminal (not gvim)
        >
        > 1/ type a line of 50 i with: <esc>50ii<esc>
        >
        > 2/ notice when pressing the last <esc>, there is a delay
        > of 1 to 2 seconds before the characters appear on the screen.
        >

        I can duplicate it (on Mac OS X with a vim built from source running in
        a Terminal), but I don't think it's a bug. When running in a terminal,
        some keys (in particular the arrow keys) generate multiple keystrokes,
        so when one of those keystrokes is received, vim (or the curses layer or
        the terminal driver, I can't remember at the moment what does it) has to
        wait to see if the other keystrokes are coming or not. So in my case,
        when I hit up arrow, vim (or whatever) actually receives esc-O-A. Which
        means if it just receives an esc, it doesn't know if it's the first
        character of an up arrow (or other key that results in multiple
        keystrokes), or a lone esc. The only way it can know is to wait to see
        if the O is coming along or not. Eventually it decides not, but only
        after waiting a bit.

        Brian

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • John Little
        On Jun 3, 9:51 am, Dominique Pelle ... .vimrc existing causes :set nocompatible. No .vimrc and you get :set compatible, maximum
        Message 3 of 5 , Jun 2, 2008
        • 0 Attachment
          On Jun 3, 9:51 am, "Dominique Pelle" <dominique.pe...@...>
          wrote:

          >   but no longer happens when I delete the empty ~/.vimrc (which is
          >   very odd, what's the difference with an empty ~/.vimrc and no ~/.vimrc?)

          .vimrc existing causes :set nocompatible. No .vimrc and you get :set
          compatible, maximum vi compatibility. (I was going to say brain
          damage, but that's unfair; handicap, maybe?)

          > I've noticed that a couple of Vim commands have a lag (1 or 2 seconds?)

          See :h timeoutlen

          Regards, John

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... VIM - Vi IMproved 7.1 (2007 May 12, compiled May 29 2008 23:03:50) Included patches: 1-305 Modified by Bram Moolenaar (floating point) Compiled by
          Message 4 of 5 , Jun 2, 2008
          • 0 Attachment
            On 02/06/08 23:51, Dominique Pelle wrote:
            > Hi
            >
            > I've noticed that a couple of Vim commands have a lag (1 or 2 seconds?)
            > before the screen gets updated. Here is a simple example:
            >
            > 1/ start vim in a terminal (not gvim)
            >
            > 1/ type a line of 50 i with:<esc>50ii<esc>
            >
            > 2/ notice when pressing the last<esc>, there is a delay
            > of 1 to 2 seconds before the characters appear on the screen.
            >
            > Other observations
            >
            > - bug happens with Vim in a terminal (at least xterm and gnome-terminal)
            > - bug does not happen with gvim.
            > - bug does not happens with: 'vim -u NONE'
            > - bug happens with 'vim --noplugin' and an empty ~/.vimrc
            > but no longer happens when I delete the empty ~/.vimrc (which is
            > very odd, what's the difference with an empty ~/.vimrc and no ~/.vimrc?)
            >
            > Can anybody else reproduce this bug too?
            >
            > I'm using Vim-7.1.305 (huge) on Linux x86.
            >
            > There are other commands which show the same delay of 1 or 2 seconds
            > such as:
            >
            > - when changing till end of line with: c$foo<esc>
            > - or when inserting something before visual blockwise:<ctrl-v>jjjIfoo<esc>
            >
            > -- Dominique

            VIM - Vi IMproved 7.1 (2007 May 12, compiled May 29 2008 23:03:50)
            Included patches: 1-305
            Modified by Bram Moolenaar (floating point)
            Compiled by antoine.mechelynck@...
            Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
            [...]

            I can reproduce it in konsole, but only in 'nocompatible' mode -- notice
            that an empty vimrc still sets that:

            vim --noplugin -u /dev/null

            inserts the 50 i immediately ('compatible' is on when using the -u
            command-line argument), but if I retry after ":set nocp" in the same
            session there is a wait of about 1 second, or maybe slightly less,
            before they appear.

            With

            c$foo<esc>

            I don't see any wait: Insert mode is entered when I hit the dollar sign,
            "foo" is entered as I type it, <esc> goes back to Normal mode.

            With <block visual>Ifoo<esc> I do see it (I tried it with a somewhat
            larger block, not just 3 lines by 1 column).

            IIUC Vim is waiting for possible multibyte keycodes starting with Esc,
            its delay is 1 second for both mappings and keycodes, as can be seen by:

            :set timeout? ttimeout? timeoutlen? ttimeoutlen?
            timeout
            nottimeout
            timeoutlen=1000
            ttimeoutlen=-1

            Setting 'ttimeoutlen' to 100 (1/10 s rather than 1s) makes the "strange"
            behaviour disappear, because then Vim waits only 0.1s for keycodes, a
            time too short to be noticed.


            Best regards,
            Tony.
            --
            By doing just a little every day, you can gradually let the task
            completely overwhelm you.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Dominique Pelle
            On Tue, Jun 3, 2008 at 3:55 AM, Tony Mechelynck ... Thanks. With :set timeoutlen=100 I no longer observe any noticable delay indeed. Good. :help ttm
            Message 5 of 5 , Jun 2, 2008
            • 0 Attachment
              On Tue, Jun 3, 2008 at 3:55 AM, Tony Mechelynck
              <antoine.mechelynck@...> wrote:

              > On 02/06/08 23:51, Dominique Pelle wrote:
              >> Hi
              >>
              >> I've noticed that a couple of Vim commands have a lag (1 or 2 seconds?)
              >> before the screen gets updated. Here is a simple example:
              >>
              >> 1/ start vim in a terminal (not gvim)
              >>
              >> 1/ type a line of 50 i with:<esc>50ii<esc>
              >>
              >> 2/ notice when pressing the last<esc>, there is a delay
              >> of 1 to 2 seconds before the characters appear on the screen.
              >>
              >> Other observations
              >>
              >> - bug happens with Vim in a terminal (at least xterm and gnome-terminal)
              >> - bug does not happen with gvim.
              >> - bug does not happens with: 'vim -u NONE'
              >> - bug happens with 'vim --noplugin' and an empty ~/.vimrc
              >> but no longer happens when I delete the empty ~/.vimrc (which is
              >> very odd, what's the difference with an empty ~/.vimrc and no ~/.vimrc?)
              >>
              >> Can anybody else reproduce this bug too?
              >>
              >> I'm using Vim-7.1.305 (huge) on Linux x86.
              >>
              >> There are other commands which show the same delay of 1 or 2 seconds
              >> such as:
              >>
              >> - when changing till end of line with: c$foo<esc>
              >> - or when inserting something before visual blockwise:<ctrl-v>jjjIfoo<esc>
              >>
              >> -- Dominique
              >
              > VIM - Vi IMproved 7.1 (2007 May 12, compiled May 29 2008 23:03:50)
              > Included patches: 1-305
              > Modified by Bram Moolenaar (floating point)
              > Compiled by antoine.mechelynck@...
              > Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
              > [...]
              >
              > I can reproduce it in konsole, but only in 'nocompatible' mode -- notice
              > that an empty vimrc still sets that:
              >
              > vim --noplugin -u /dev/null
              >
              > inserts the 50 i immediately ('compatible' is on when using the -u
              > command-line argument), but if I retry after ":set nocp" in the same
              > session there is a wait of about 1 second, or maybe slightly less,
              > before they appear.
              >
              > With
              >
              > c$foo<esc>
              >
              > I don't see any wait: Insert mode is entered when I hit the dollar sign,
              > "foo" is entered as I type it, <esc> goes back to Normal mode.
              >
              > With <block visual>Ifoo<esc> I do see it (I tried it with a somewhat
              > larger block, not just 3 lines by 1 column).
              >
              > IIUC Vim is waiting for possible multibyte keycodes starting with Esc,
              > its delay is 1 second for both mappings and keycodes, as can be seen by:
              >
              > :set timeout? ttimeout? timeoutlen? ttimeoutlen?
              > timeout
              > nottimeout
              > timeoutlen=1000
              > ttimeoutlen=-1
              >
              > Setting 'ttimeoutlen' to 100 (1/10 s rather than 1s) makes the "strange"
              > behaviour disappear, because then Vim waits only 0.1s for keycodes, a
              > time too short to be noticed.


              Thanks. With ":set timeoutlen=100" I no longer observe any noticable
              delay indeed. Good. ":help ttm" says:

              A useful setting would be:
              :set timeout timeoutlen=3000 ttimeoutlen=100

              I added that to my ~/.vimrc and it eliminates the noticeable delay in
              the test cases that I described.

              Thanks again
              -- Dominique

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            Your message has been successfully submitted and would be delivered to recipients shortly.