While moving the cursor across a vim process open in a tmux session, every now and then, why does it leave a trail of ghost characters - ^[OB, ^[OA?

后端 未结 4 416
借酒劲吻你
借酒劲吻你 2021-02-04 15:48

These disappear if I do a page-up and page-down. Why does this happen and how do I rectify it?

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

I recently fiddled around with

相关标签:
4条回答
  • 2021-02-04 15:48

    This issue is discussed at length on the Vim Wiki article. There seem to be multiple causes, I personally encountered this issue when running vim under tmux.

    A solution from there that worked for me and seems less hacky than mapping the keys was the following config:

    set term=cons25

    0 讨论(0)
  • 2021-02-04 15:51

    Do you happen to be using zsh? I had this issue with vim + zsh/oh-my-zsh. Moving back to vanilla bash solved this issue (amongst others) that I was having with vim.

    0 讨论(0)
  • 2021-02-04 15:54

    Hard to say without knowing what's in your vimrc, but you can confirm whether it's something in there by starting it up without running it and seeing if it still happens using the following...

    vim -u NONE

    0 讨论(0)
  • 2021-02-04 16:01

    ^[OB and ^[OA are how your terminal represent <down> and <up>.

    I've seen these (and their friends ^[OC and ^[OD) appear in the "command line" or omni-completion menus and during usage of a couple of plugins in vim in tmux.

    My solution was to map them to the directional keys:

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

    In case you don't know, you must not type ^[ as two characters, you must do <C-v><Esc>.

    That is, while in --INSERT-- mode press the Control key and the V key together then hit the Escape key. Doing so will input the correct single character that looks like ^[.

    0 讨论(0)
提交回复
热议问题