While working in an Ubuntu VirtualBox (host is also Ubuntu), gvim is being really slow at showing the last character I just typed, or, when I move the cursor up/down/left/right, it also takes 1 to 2 seconds before the last position is shown. Everything else is fast as usual, it's only that last small glitch that makes it really hard to use.

I found this post (Sometimes gvim doesn't show character typed immediately), which mentions maps.

I also found this post of stackoverflow (Why is Vim so slow?), and tried with:

gvim -u NONE

to make sure that the syntax, maps (as mentioned above), the 'cc' variable, etc. would not be the culprit. The issue persists (although I can feel it's a tad faster, probably because of the syntax removal).

My feel would be that vim/gvim makes use of a timer to know when to display that last character and that timer is probably in the low ms (maybe 25ms) and a VirtualBox does not have that kind of ability (I tested with my own software a while back and it's just horrendously bad).

Would there be a way to remove that 1 to 2 second delay that I missed?

Note: When moving around with the mouse, I do not get the issue. The placement with a click is instantaneous.

Update 1: I tested with the timeout and ttimeout and the corresponding length of time to wait, timeoutlen and ttimeoutlen.

Here are the commands I tested with:

:set timeoutlen=10000
:set ttimeoutlen=10000
:set timeout!
:set ttimeout!

and the issue is still there. Fast while I type up until the last character. Only in gvim...

Update 2: Note that happens with ANY character. It could be a space, a-z, 0-9, any usual character. The last one I type takes about 1s to appear. It has nothing to do (I would imagine) with the mapping capability. Although it does seem related to one of those delays because if I type another character, it shows the previous one instantaneously. And as mentioned above, it also happens when I use the arrow keys (Up, Down, Left, Right). It will move quickly to the line/character just before the one select. That last one will be shown about 1s later... so I often end up one line too high or too low.

Update 3: Oh... the previous changes made me think that maybe it has something to do with the blinking cursor, so I tried this command:

set guicursor+=a:blinkon0

and interestingly enough, while I type, I never see the last character. Once I'm done typing, the last character never actually appears. So the blinking cursor actually helps showing that last character!

  • 2
    The way you wrote your question makes it sound like a VirtualBox issue. Do other applications show similar lags or is it just gVim?
    – Friedrich
    Commented Sep 7, 2023 at 19:45
  • @Friedrich I don't see it in the console or the browsers which are nearly the only other two things I use pretty consistently in the VM. Commented Sep 7, 2023 at 20:40
  • To find out if it is related to map I would issue the following Vim command :set timeoutlen=10000 if the delay for the last character increase to 10 sec we know it is related to mapping. You could also issue :set ttimeoutlen=10000. Could you try that and let us know the result? Could you tell us which keys led to the problem? Is it in insert mode or in normal mode? Commented Sep 8, 2023 at 4:12
  • @VivianDeSmedt Thank you for the info. I tried those and it did not seem to help. I even turned off the timeout and ttimeout flags (:set [t]timeout!) and it still waiting about 1s to display the last thing I typed or the cursor after arrow movements. Commented Sep 8, 2023 at 17:20
  • 1
    @VivianDeSmedt I tried both ways, large numbers, small numbers, on/off, no difference. However, the non-blinking cursor is an interesting one since nothing appears when not blinking. Commented Sep 9, 2023 at 14:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.