2

Sometimes (about once/twice a day), when I open a file in vim, I get a strange line containing meta control characters right at the top of the buffer.

strange line

The line goes away when I refresh the buffer, so it's not really a problem.

I'm just curious to know why it happens. I run vim in a terminal and I'm on ubuntu 18.04.

$> vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453

I've used vim on various machines for many years, but my current laptop is the only one where I've seen this happen.

9
  • 1
    I think it'll be useful if you could include a copy of your ~/.vimrc and perhaps the list of plugins that you use in ~/.vim/
    – John
    Commented Sep 12, 2019 at 11:01
  • 1
    Also, which terminal are you using? What is $TERM set to in your shell inside that terminal?
    – filbranden
    Commented Sep 12, 2019 at 11:40
  • 3
    this is most likely a problem of your terminal configuration. Make sure that $TERM is correct. Also you seem to have termguicolors set. Make sure your terminal actually understands that. Commented Sep 12, 2019 at 11:43
  • 2
    I could be wrong but the first CSI sequence (^[[2;2R) looks like the reply to a DSR sequence (Device Status Report). I think it reports the cursor position; here row 2, column 2. The second CSI sequence (^[[>1;5202;0c) looks like the reply to a Send Device Attributes sequence (CSI > Pp ; Pv ; Pc ; c). It's claiming that the terminal type is VT220 (because here Pp is 1), and that its firmware/patch version is 5202 (because here Pv is 5202).
    – user938271
    Commented Sep 12, 2019 at 12:12
  • 2
    The purpose of the first OSC sequence (^[]10;rgb:0000/0000/0000^G) is to change the text foreground color, and the last OSC sequence (^[]11;rgb:e0e0/e0e0/e0e0^G) changes the text background color. You can find all of this information on: invisible-island.net/xterm/ctlseqs/ctlseqs.html I guess some program sends those sequences to get some info about the terminal and to change some of its attributes, but the terminal doesn't understand them. As already said, it's often an issue with TERM, or maybe some Vim terminal-related options (:set termcap, :h termcap).
    – user938271
    Commented Sep 12, 2019 at 12:12

1 Answer 1

2

I got the same issue on Ubuntu 20.04 and VIM - Vi IMproved 8.2 and I am using gruvbox color scheme (I also have some other vim plugins like syntastic).

After adding autocmd vimenter * colorscheme gruvbox in my .vimrc before the loading of my plugin manager (pathogen) this went off (I've also removed my previous colorscheme gruvbox command from my .vimrc of course).

I guess if you are also using a color scheme and if you replace "gruvbox" by your desired color scheme this might work for you as well.


Notes

1
  • 1
    It's been a long time since I last saw this happen, but I have no idea whether I did something to make it go away. Although I don't use gruvbox, I'm going to "accept" your answer for all the details you've added. Thanks.
    – Gautam
    Commented Jul 8, 2020 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.