You are not logged in.

#1 2017-08-21 18:07:05

Ifnister
Member
Registered: 2017-06-20
Posts: 15

Stuttering in vim

Hello,

whenever I'm editing text inside vim, it freezes for a brief amount of time every so often. For example, I can be going to the bottom of a file by pressing j or the down arrow and then it will freeze and the cursor will have traveled the correct distance in this time once the normal state is restored. This occurs also while typing, sometimes it freezes and the text is not appearing but it will afterwards.
I can reproduce this easily:

  • Open vim

  • Start typing text fast

  • By the second line it freezes.

I've also noticed that the hard drive light turns on and then it freezes. I have checked that the hard drive is not spinning down (I saw it in another question) but

hdparm -B /dev/sda

reports 128, which does not allow spinning down (https://wiki.archlinux.org/index.php/Hdparm).
- It happens with a .vimrc file empty or the one I usually use
- It happens with the

~/.vim

being empty or being the one I usually use
- It happens both with vim and gvim of the packages vim and gvim
- It happens using gnome-terminal (I use xfce4-terminal).
- It does not happen in other editors such as vi or nano
- In general, it does not happen anywhere else I can remember. I do everything else without stuttering.

I'm on a laptop and using xfce as DE.

Any ideas?
Thanks!

Last edited by Ifnister (2017-08-21 18:17:11)

Offline

#2 2017-08-21 18:36:47

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Stuttering in vim

To disable fsync, I compile vim with:

sed -e "s:HAVE_FSYNC:FSYNC_NO_THANKS:" -i src/fileio.c

Edit: Runtime options to try: noswapfile, and nofsync.

Last edited by brebs (2017-08-21 18:47:34)

Offline

#3 2017-08-21 21:00:47

Ifnister
Member
Registered: 2017-06-20
Posts: 15

Re: Stuttering in vim

Both options are turned on by default in my vim. It seems turning off fsync does nothing as the stuttering is still there.
However I've followed the steps to reproduce it that I explained in the post with swapfile off and it seems there is no stuttering.
I'm testing it tomorrow and the day after tomorrow and if this solves it I'll mark it as solved.

It's surprising to me that swapfile is causing this, I've never thought this was a slow hard drive. I bought the laptop I'm using very few months ago. My 10 year old desktop with its old drives that are still running never had this problem and I don't think its drives are much more better...
Thank you for the answer

Offline

#4 2017-08-21 23:16:11

jsoy9pQbYVNu5nfU
Member
Registered: 2013-04-19
Posts: 108

Re: Stuttering in vim

Ifnister wrote:

Both options are turned on by default in my vim. It seems turning off fsync does nothing as the stuttering is still there.
However I've followed the steps to reproduce it that I explained in the post with swapfile off and it seems there is no stuttering.
I'm testing it tomorrow and the day after tomorrow and if this solves it I'll mark it as solved.

It's surprising to me that swapfile is causing this, I've never thought this was a slow hard drive. I bought the laptop I'm using very few months ago. My 10 year old desktop with its old drives that are still running never had this problem and I don't think its drives are much more better...
Thank you for the answer

You could try and see if the problem persists when you put the swap file into a tmpfs like /run, /dev/shm or /tmp (if you've got one there)

set directory=$HOME/.tmpfs

Other interesting options are

updatecount
updatetime

to change swap file updating behaviour, and whether the problem persists in neovim which has decoupled the terminal UI from the editor engine to a much greater degree than plain vim by now?

Offline

#5 2017-08-22 09:13:48

woodape
Member
Registered: 2015-03-25
Posts: 159

Re: Stuttering in vim

Are you sure its a vim issue? What terminal emulator are you using, what graphics driver? I had a similar issue using urxvt with the xf86-intel driver. I switched to kernel modsetting and never had an issue again.

EDIT: I missed that you said it happens in gvim and mentioned your terminal.

Last edited by woodape (2017-08-22 09:20:53)

Offline

Board footer

Powered by FluxBB