0

While editing vim sometimes doubles characters. That is, while typing, some characters APPEAR twice. If I try to delete, vim deletes the characters in a different order than they appear. If I do not delete but save the file, quit vim, reopen the file, I can see that in fact there was no doubling of characters, it just appeared like that.

Tried setting notimeout, and also setting backupdir on local a directory but the problem remains.

Also while I am moving around in normal mode with hjkl, sometimes the given character appears in the terminal, ie. I am pressing 'j' several times moving the cursor down, and it leaves behind a trail of 'j' characters, which are in fact not written into the file, I see them only in the terminal, closing vim and reopening the file solves the problem temporary.

It is fairly annoying because I can't type a line of code or move a page down without experiencing this problem.

I am using Ubuntu 10.10 with:

  • gnome-terminal 2.32.0
  • curlftpfs 0.9.2
  • libcurl/7.21.0
  • fuse/2.8
5
  • Does it still happen if you try a different terminal emulator? (e.g. xterm or konsole instead of gnome-terminal) Does it happen in gVim?
    – Heptite
    Commented Apr 24, 2011 at 20:06
  • It does happen with xterm, but after using gvim for a couple of minutes it seems ok. Thanks for the tip, I can work with this now, but for the long run I still would like to know what causes it, if you have any ideas...
    – Ashnur
    Commented Apr 24, 2011 at 20:25
  • My best guess is that your terminal is in a slightly wrong state, which can be caused if the $TERM environmental variable is incorrectly set. Are you overriding this variable anywhere? What does "echo $TERM" at the command-line in the terminal show?
    – Heptite
    Commented Apr 24, 2011 at 20:53
  • it says 'xterm' :(, i guess that's not the expected.
    – Ashnur
    Commented Apr 24, 2011 at 22:51
  • For gnome-terminal and xterm, "xterm" is a valid value for the $TERM environmental variable. So at this point I'm at a loss.
    – Heptite
    Commented Apr 25, 2011 at 0:48

1 Answer 1

0

I had this problem recently. In my case, the symptoms were:

  • the hjkl characters, or escape sequences associated with the cursor keys, appear when moving in Command mode

  • lines would corrupt in Command and Insert modes, it appears as if the lines are not updating properly.

These effects don't occur in gVim, but do occur regardless of terminal emulator used.

I was using a Vim configuration that I downloaded – it defined a function that ran a shell command that returned which git branch the file was from. The output would printed onto the status bar. However, I don't have git installed, so this always raised an exception. Removing the function completely solved my problem.

The errors only occur when the screen changes, which is when this function is called. I think constantly invoking the shell and having it return an exception every time you press a key is slowing the terminal emulator down enough to prevent it updating properly. The errors occurred more frequently when I had many open Firefox tabs, or I hold down the hjkl or cursor keys.

To solve, try disabling any functions in your .vimrc file that invoke the shell, are likely to raise exceptions, or be time-consuming.

1
  • This sounds really promising, as I too have a function to show the current git branch. I will disable it, and test if anything changes.
    – Ashnur
    Commented Aug 15, 2011 at 8:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .