as many others, i was interested in changing the cursor shape. For KDE4
and GNOME i found these solutions:
In KDE4 : Put
<code>
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
</code>
into your vimrc.
In GNOME 2.26 : Put
<code>
if has("autocmd")
au InsertEnter * silent execute "!gconftool-2 --type string
--set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
au InsertLeave * silent execute "!gconftool-2 --type string
--set /apps/gnome-terminal/profiles/Default/cursor_shape block"
au VimLeave * silent execute "!gconftool-2 --type string
--set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
endif
</code>
into your vimrc. (In case they get wrapped in this post: these are five
lines.) If you use more than one profile in gnome-terminal, you might
have to tweak this a little.
Have a nice day,
André
--
«Dans la vie, rien n'est à craindre, tout est à comprendre»
Marie Sklodowska Curie.
http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes
Maybe you can add urxvt to it.
Have a nice day.
André
That won't play nicely with gnu screen, or with dvtm, or any of the
other terminal multiplexers out there...
> In GNOME 2.26 : Put
>
> <code>
> if has("autocmd")
> au InsertEnter * silent execute "!gconftool-2 --type string
> --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
>
> au InsertLeave * silent execute "!gconftool-2 --type string
> --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
>
> au VimLeave * silent execute "!gconftool-2 --type string
> --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
> endif
> </code>
>
> into your vimrc. (In case they get wrapped in this post: these are five
> lines.) If you use more than one profile in gnome-terminal, you might
> have to tweak this a little.
Unless I'm misunderstanding something, this would not only work
improperly when combined with tools like screen and dvtm, but also -
when you have multiple terminals open it would change the cursor shape
in all of them!
~Matt
Thank you!
Any solution for konsole KDE3 ? none works :-/
--
Greg
That reminds me ... I just added Matt's comments to the tip,
where he says it will give trouble with screen and dvtm.
Please update the tip with any developments.
John
And that reminds *me*... unless I'm mistaken, both the gnome-terminal
tip and the konsole tip will have problems with multiple tabs.
~Matt
As we know KDE and GNOME are two most popular Linux desktop environments
and the terminal emulator included is there.
However, I use different computers, they have KDE or GNOME, and I often
need to use vim in remote ssh sessions, such as open the GNOME terminal
locally and ssh to a remote computer which has KDE.
Any one knows how to check in .vimrc whether I'm in KDE4 Konsole or in
GNOME terminal in a remote ssh session?
That's not a big problem for gnu screen, since we've got &term=='screen'
in screen and &term=='xterm' in konsole. I can enable the sequences only
for &term=='xterm'.
The problem is: too many terminal emulators claims to be &term=='xterm'
while they are not identical. It would be much better if there's a way
to know the exact terminal emulator program name in .vimrc.
Am 07.04.2009 13:49, pansz schrieb:
> [...]
> Any one knows how to check in .vimrc whether I'm in KDE4 Konsole or in
> GNOME terminal in a remote ssh session?
> [...]
I don't know if it works with SSH put you can query the COLORTERM
environment variable:
:echo $COLORTERM
Gnome Terminal sets it to gnome-terminal. I don't know what Konsole does.
HTH,
Dennis Benzinger
Well, as I said later, it also might not play nicely with multiple
tabs, or even multiple terminals (at least, the suggest gnome-terminal
version wouldn't, not sure about the suggested konsole version).
> The problem is: too many terminal emulators claims to be &term=='xterm'
> while they are not identical. It would be much better if there's a way
> to know the exact terminal emulator program name in .vimrc.
Set up the terminal emulator to send something more correct; any sane
terminal emulator should let you. It's perfectly common to set up
xterm to set TERM=xterm-256color, to set up konsole to set
TERM=konsole-256color, to set up screen to set TERM=screen-256color,
etc... Unfortunately, to the best of my knowledge gnome-terminal
fails this sanity test - I know of no way to get it to set $TERM to
the correct value (gnome-256color) without patching the source and
recompiling.
~Matt
On my system it doesn't set it. Anyway, I suppose that a value of
"gnome-terminal" would be rather characteristic. Remains to be seen how
to tell xterm apart from konsole. From v:termresponse maybe? Let's see
what I get:
konsole... ^[[0;115;0c
xterm... ^[[0;236;0c
gnome-terminal... ^[[1;1704;0c
(where the initial ^[ is an "escape" character) so the results are
indeed different, but I don't think the criterion can be ported to an
unknown system (I mean, you need to make the experiment separately for
each installation -- and it may change if you upgrade one of these
packages).
Best regards,
Tony.
--
If God is perfect, why did He create discontinuous functions?
It seems work, but we may need to do some regexp matching...
Let's see what I get:
konsole1... ^[[0;115;0c
konsole2... ^[[0;115;0c
xterm... ^[[0;239;0c
gnome-terminal... ^[[1;1613;0c
xfce4-terminal... ^[[1;1613;0c
screen... (nothing)
So the number may not be exactly the same, while we should tell
differences between konsole and gnome-terminal anyway. While the konsole
in KDE3 and KDE4 returns the same value, which is somewhat undesirable.