0

When I'm not in insert mode and I'm navigating around my file with the motion keys (hjkl etc), the keys often appear in the buffer (illustrated below). I can observe this effect pretty readily in tmux, but it doesn't seem to happen without. If I run :!reset in vim the buffer returns to normal, but it doesn't stay that way for long. I'm not sure why this is happening and google yielded nothing. Halp?

Edit: It seems just a simple :e will fix the problem, too.

An illustration of the problem

benekastah
  • 5,651
  • 1
  • 35
  • 50
  • Are those keys actually in the file, or are they just showing on the screen? Find out by hitting Ctrl+L to force a screen redraw in vi. – steveha Nov 15 '13 at 23:55
  • I'm pretty sure they're only on the screen. As soon as I can replicate the issue again I'll test Ctrl+L. I restarted tmux and the problem hasn't reappeared yet. – benekastah Nov 16 '13 at 00:02
  • I wouldn't be surprised if there's a bug in tmux that doesn't turn echoing back off correctly when you change things. – Adam D. Ruppe Nov 16 '13 at 00:55
  • I don't know enough about tmux to know what you mean when you say "echoing". Do you mean that if I change my config there could be some issues that restarting the server would generally solve? – benekastah Nov 16 '13 at 01:13
  • 1
    What is the output of `echo $TERM` inside and outside `tmux`? – jasonwryan Nov 16 '13 at 02:11
  • @jasonwryan In tmux I get `screen-256color`; outside of tmux I get `xterm-256color`. Should they match? – benekastah Nov 16 '13 at 05:23
  • 1
    No: that is correct. 9 times out of 10, these sorts of issues are because of an incorrect $TERM. – jasonwryan Nov 16 '13 at 05:53
  • 1
    Can you start [tag:vim] with an empty [tag:vimrc] and all plugins deactivated and try if that problem still persists? – pfnuesel Nov 16 '13 at 13:48

2 Answers2

1

I experience the same thing. A few extra observations:

  • it only seems to happen when I hold down a motion key like j or k, causing rapid repeats
  • it happens both in and outside of tmux, but much more often in tmux
  • it happens much more often since I enabled vim-go's go_auto_sameids, which I believe is making a call to an external program (guru) for every cursor movement

This leads me to assume that it's a timing issue in vim that is exacerbated by latency added by things like tmux and/or plugins.

(Using gnome terminal; $TERM is screen-256color in tmux and xterm-256color outside)

Jeremy Huiskamp
  • 5,186
  • 5
  • 26
  • 19
0

I think this was alluded to on the tmux mailing list recently. Try decreasing the value of the escape-time parameter in tmux, so that tmux more quickly sends the escape character to vim to return to command mode, rather than waiting for more characters in an escape sequence. The default value is 500ms, so try something smaller, like 50.

In .tmux.conf:

set-option -g escape-time 50
chepner
  • 497,756
  • 71
  • 530
  • 681
  • I might be misreading your question; I observe something similar when quickly issuing commands after returning to command mode. – chepner Nov 18 '13 at 13:45
  • I'll check to see if this helps, although it seems like this might be addressing a different issue. To get the screenshot I posted above, I stayed in vim (didn't have to enter/exit tmux command mode). – benekastah Nov 18 '13 at 18:06