Thursday, February 23, 2012

Vim Cursor Color Terminal Bug

I encountered this pretty strange bug when I was trying to fix my Vim
cursor color.

I am using Terminator and I found out that the cursor colors for my
color scheme were not working. I did a Google search and was brought
to this site where I used this snippet of code:

if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;red\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal
endif

The cursor colors changed and things worked fine. However, I
encountered a weird bug after including this code. Say I opened a new
terminal, entered Vim and then just quit. My shell prompt will
suddenly go to the bottom of the terminal and there would be a huge
chunk of whitespace/newlines between the top of the terminal (where
the previous prompt was) and the new prompt at the bottom of the
terminal. I commented out this line:

silent !echo -ne "\033]12;red\007"

And the bug went away but then the cursor color doesn't change now.
I'm not too familiar with vimscript or shell script so it would be
great if anyone could help me out in fixing this little bug.

Thanks! :)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: