Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using PuTTY to connect over SSH to an Ubuntu server from my Windows 7 workstation. Once connected I am using the Vim installation from the Ubuntu server to edit files. I want the cursor to change when I go into and out of insert mode. Part of my .vimrc file is like this but it is not changing the cursor:

if &term =~ "xterm"
    echo "xTerm!!inate!"
    let &t_SI = "\<Esc>]12;purple\x7"
    let &t_EI = "\<Esc>]12;blue\x7"
endif

I know that the if statement is executing because of the echo.

EDIT: Actually I would prefer to change the cursor to be a vertical line like you can in the PuTTY settings rather than change the color, or maybe even do both. But just changing the color would be a lot better than nothing. Also I am willing to change terminals if there is another Windows 7 Professionsal 64 bit compatible terminal that can do this (preferably something free). Maybe Poderosa can do this?

share|improve this question

1 Answer 1

Your example appears to work just fine using xterm, so I don't think it is your .vimrc that is the problem.

Digging a little deeper, it appears that PuTTY doesn't appear to implement the OSC escape code that you are using to change the colour of the cursor (see do_osc in terminal.c in the PuTTY sources). Browsing the sources, I couldn't find any other mechanism to do something similar, either. This means that there probably isn't going to be an easy way to get this working in PuTTY.

Your solutions are thus likely to be limited to:

  1. Trying to plead with the PuTTY authors to implement the relevant OSC escape code;
  2. Changing your terminal program; or
  3. Finding another way to let vim know what mode you are in.

I suspect the third is going to be the easiest, unfortunately.

share|improve this answer
    
Is there a different terminal that will let you change the cursor width or color? –  INTPnerd Jun 30 '11 at 16:16
1  
@INTPnerd Mintty. It's derived from PuTTY, but it's generally more compatible with xterm and does support the xterm colour sequences (except that it only supports colour values, not names). It also implements a control sequence for changing cursor style. See this tip on how to put that to use in vim. Mintty requires Cygwin or MSYS though. –  ak2 Jun 30 '11 at 19:26
    
@ak2 Thanks! Mintty works for this, but there is an annoying delay before the cursor changes when changing modes. IDK if that's Mintty's fault or not... –  INTPnerd Jun 30 '11 at 21:13
    
@INTPnerd That's vim's escape timeout. See the next tip on how to avoid it. –  ak2 Jul 1 '11 at 3:04
    
I don't think that's it. I tried that tip and it did not help. The delay is not only when I press escape to leave insert mode but also when I enter insert mode. –  INTPnerd Jul 1 '11 at 16:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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