Only problem is that vim changes it back to the default underline cursor. I
can't find the correct command to change the shape of the cursor in vim.
I've seen some remarks about 'guicursor' and 'termcap-cursor-shape' but
there doesn't seem to be a plain 'cursor' attribute that I can find and
trying to set 'termcap-cursor-shape' gives me an unknown variable error.
Any ideas?
--
For 20 dollars, I'll give you a good fortune next time ...
I presume you're on a Unix-like system. If you're on Windows, perhaps
'guicursor' is relevant. But, assuming you're not...
What's the escape code?
You need to put it into the t_SI and/or t_EI options much like shown at
:help termcap-cursor-shape
i.e. with something like
let &t_SI = "\<Esc>]12;purple\x7"
let &t_EI = "\<Esc>]12;blue\x7"
but obviously with more shape than colour-related escapes.
Cheers,
Ben.
|termcap-cursor-shape| is not an option or a variable, it's a help tag.
If you had followed it (using ":help termcap-cursor-shape" without the
quotes), you would have seen that in Console Vim (other than Windows
console), instead of a cursor option there are two termcap codes, t_SI
(for Start Insert) to set the Insert-mode cursor, and t_EI (for End
Insert) to set the Normal-mode cursor.
If you didn't define these codes yourself (they aren't defined in
"standard" termcaps), then maybe your *x distribution dropped a system
vimrc on you. Check the ":version" output to see where it might be located.
In the Windows version of Console Vim, the 'guicursor' option (which,
again, you should have checked) can be used to set the height (but not
the width) of the cursor separately for all the same cases as in the GUI.
Best regards,
Tony.
--
"Dying is a very dull, dreary affair. And my advice to you is to have
nothing whatever to do with it."
-- W. Somerset Maugham
If you make sure these codes are undefined, Console Vim will never
change the cursor shape. This is the default and that's why I mentioned
a possible system vimrc in my reply of a few minutes ago. If such a
system vimrc exists, you can override it by
if has('unix') && !has('gui_running')
set t_SI= t_EI=
endif
Best regards,
Tony.
--
Those who educate children well are more to be honored than parents,
for these only gave life, those the art of living well.
-- Aristotle
Unless, of course, some *other* code that vim sends changes the cursor shape...
> Might just as well set then undefined then. There is one thing I noticed -
> if my TERM is set to 'linux' it changes cursor, but if I use xterm-xf86-v40
> it doesn't change the cursor.
So, based upon this, the answer was easy enough to find. Just
looking at the output of 'infocmp -d linux xterm-xf86-v40'
I noticed:
cnorm: '\E[?25h\E[?0c', '\E[?25h'
Which, thanks to 'man 5 terminfo', you can explain as "To reset
the cursor to normal visibility, rather than invisible or very
visible, in a linux terminal, send the code '<Esc>[?25h<Esc>[?0c'.
To do the same for an xterm-xf86-v40 terminal, send the code
'<Esc>?25h'." This means that on a "linux" terminal, the cursor
shape will be reset to the default.
To change that, you could throw this into your ~/.vimrc:
if 1
let &t_ve = substitute(&t_ve, '\e[?\zs0c', '6;14;224c', 'g')
endif
That says "If the terminal's 've' attribute (which is the termcap
name for what terminfo calls 'cnorm') matches /\e[?0c/, replace
the 0c with 6;14;224c" - ie, use *your* prefered cursor type,
instead of the default cursor type. It's pretty likely that other
applications will also use cnorm, though, so you might want to
just change your 'cnorm' sequence in your terminfo database,
instead...
~Matt