Weltensegler (talk | contribs) (Works in multiple tabs in Konsole.) |
JohnBeckett (talk | contribs) (Undo revision 37936 by 106.114.184.43 (talk)) |
||
(10 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipNew |
||
− | {{TipProposed |
||
− | |id= |
+ | |id=1622 |
− | |previous= |
+ | |previous=1621 |
− | |next= |
+ | |next=1623 |
|created=March 28, 2009 |
|created=March 28, 2009 |
||
|complexity=basic |
|complexity=basic |
||
Line 23: | Line 23: | ||
If you use more than one profile in gnome-terminal, you might have to adapt this to your profiles. |
If you use more than one profile in gnome-terminal, you might have to adapt this to your profiles. |
||
+ | |||
+ | ==For iTerm2 on OS X == |
||
+ | <pre> |
||
+ | let &t_SI = "\<Esc>]50;CursorShape=1\x7" |
||
+ | let &t_EI = "\<Esc>]50;CursorShape=0\x7" |
||
+ | </pre> |
||
+ | |||
+ | |||
+ | For tmux running in iTerm2 on OS X: |
||
+ | <pre> |
||
+ | let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" |
||
+ | let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" |
||
+ | </pre> |
||
+ | In theory, the escape sequence could be used for tmux in any terminal. |
||
+ | |||
+ | NOTE: These do not work with the default terminal. |
||
==For Konsole in KDE4== |
==For Konsole in KDE4== |
||
Line 31: | Line 47: | ||
This works with multiple tabs and windows. |
This works with multiple tabs and windows. |
||
+ | |||
+ | ==For xfce-terminal== |
||
+ | <pre> |
||
+ | if has("autocmd") |
||
+ | au InsertEnter * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_BLOCK/TERMINAL_CURSOR_SHAPE_UNDERLINE/' ~/.config/Terminal/terminalrc" |
||
+ | au InsertLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_UNDERLINE/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/Terminal/terminalrc" |
||
+ | au VimLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_UNDERLINE/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/Terminal/terminalrc" |
||
+ | endif |
||
+ | </pre> |
||
==See also== |
==See also== |
||
− | *[[ |
+ | *[[Configuring the cursor]] |
==Comments== |
==Comments== |
Revision as of 07:06, 2 November 2014
created March 28, 2009 · complexity basic · author Weltensegler · version 7.0
To change the shape of the cursor in different modes, you can add the following into your vimrc.
For the Gnome-Terminal (version 2.26)
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
If you use more than one profile in gnome-terminal, you might have to adapt this to your profiles.
For iTerm2 on OS X
let &t_SI = "\<Esc>]50;CursorShape=1\x7" let &t_EI = "\<Esc>]50;CursorShape=0\x7"
For tmux running in iTerm2 on OS X:
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
In theory, the escape sequence could be used for tmux in any terminal.
NOTE: These do not work with the default terminal.
For Konsole in KDE4
let &t_SI = "\<Esc>]50;CursorShape=1\x7" let &t_EI = "\<Esc>]50;CursorShape=0\x7"
This works with multiple tabs and windows.
For xfce-terminal
if has("autocmd") au InsertEnter * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_BLOCK/TERMINAL_CURSOR_SHAPE_UNDERLINE/' ~/.config/Terminal/terminalrc" au InsertLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_UNDERLINE/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/Terminal/terminalrc" au VimLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_UNDERLINE/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/Terminal/terminalrc" endif
See also
Comments
In a vim_use thread on 31 March 2009, Matt Wozniski made the following comments:
Re the Gnome code: 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!
Re the KDE4 code: That won't play nicely with gnu screen, or with dvtm, or any of the other terminal multiplexers out there.
Both will probably have problems with multiple tabs.