Moving the cursor through the vim process in a tmux session, from time to time, why does it leave a trace of ghost characters - ^ [OB, ^ [OA?

They disappear if I make the page show up and down. Why is this happening and how to fix it?

http://i.stack.imgur.com/DnMYl.png

I recently messed with my vimrc. Could this be the reason?

UPDATE: I understood the reason. I added to the functions that automatically update the cwd name and the current git branch in my vim status line. This made vim be laggy, and every time it lagged the up / down / left / right key press, it typed ghost characters ^ [OA etc. It is possible that the material became complicated because I used vim in tmux, but I saw ghost characters outside of tmux. So probably not. I disabled these two functions in my .vimrc, and my vim status line is now less surprising than before :( I wish you a way out.

+7
source share
4 answers

^[OB and ^[OA correspond to your terminal <down> and <up> .

I saw how these (and their friends ^[OC and ^[OD ) appear on the command line or pop-up menus and while using a pair of plugins in vim in tmux.

My solution was to match them with directional keys:

 map ^[OA <up> map ^[OB <down> map ^[OC <right> map ^[OD <left> 

If you do not know, you should not type ^[ as two characters, you should make <Cv><Esc> .

That is, in --INSERT-- mode --INSERT-- press the Control key and V , then press the Escape key. This will introduce the correct single character, which looks like ^[ .

+5
source

It's hard to say without knowing what is in your vimrc, but you can confirm that there is something there by running it, not starting it and not seeing if this is still happening, using the following ...

vim -u NONE

+1
source

This issue is discussed in detail in a Vim Wiki article . It seems that there are several reasons I personally ran into this problem when running vim under tmux.

The solution from there, which worked for me and looked less hacked than key mapping, was the following configuration:

set term=cons25

+1
source

Do you accidentally use zsh? I had this problem with vim + zsh / oh-my-zsh. Returning to bash vanilla, I solved this problem (among other things) that I had with vim.

0
source

All Articles