# VimEnter autocmd to change cursor shape sometimes outputs escape sequences

Inspired by this answer, I have the following in my vimrc:

augroup cursor
au!
autocmd VimEnter * silent !echo -ne "\e[1 q"
augroup end


However, this sometimes prints the following on startup:

^[[2;2R^[[>65;5402;1c^[]10;rgb:b2b2/b2b2/b2b2^[\^[]11;rgb:0000/0000/0000^[\


What is causing this? The work around I came up with was to add autocmd VimEnter * redraw!, but I would like to know the root cause and if there is a better way to fix this.

• What terminal emulator are you using? – ZeroKnight Apr 30 at 9:12
• Are you using tmux as well? If so, does this happen outside of tmux as well, or only in tmux? – ZeroKnight Apr 30 at 9:21
• Studying those sequences, the first two are CSI sequences. ^[[2;2R is the terminal informing the application the cursor position (2, 2), ^[[>65;5402;1c I can't find anything on without knowing your terminal (possibly "Send Device Attributes"?), and the last two are OSC sequences: ^[]10;rgb...^[\  and ^[]11;rgb:...^[\ . Again, I'll need to know the terminal to begin finding out what those mean specifically, but they're setting the color of some two things. #b2b2b2 gives a light gray. Why these are showing up eludes me... – ZeroKnight Apr 30 at 10:21
• @ZeroKnight This is using termite. Not using tmux. – ngenisis May 1 at 1:35