сделать разный цвет курсора в разных режимах

и другие vi-подобные редакторы

Модератор: /dev/random

Ответить
Аватара пользователя
Reboot
Сообщения: 321
Статус: Красен глаз -- темна душа

сделать разный цвет курсора в разных режимах

Сообщение Reboot »

меня тут мысль посетила, менять цвет курсора в зависимоти от выбранного режима ввода (вставка\замена). Такое есть? Если нет, то возможно ли?
Мой компьютер зовут Марвин
Спасибо сказали:
mikluxo
Сообщения: 283
ОС: Slackware 12.2
Контактная информация:

Re: сделать разный цвет курсора в разных режимах

Сообщение mikluxo »

Поиск таки рулит. Работает только в GUI
http://vim.wikia.com/wiki/Change_cursor_co...different_modes
Ну или для xterm
John Magolske wrote:
Is there a way to tie this to something in the .vimrc that would recognize whether vim is in insert-mode or normal-mode and automatically change the cursor color accordingly?
See ":help termcap-cursor-shape".
This gets "Sorry, no help for termcap-cursor-shape" Does it have to do with not having the +cursorshape feature? Is Vim7 required? (I'm using 6.4)
The +cursorshape feature is required. For some reason, none of my Vim builds for W32 mention either +cursorshape or -cursorshape in their ":version" listings, but if I ask ":echo has('cursorshape')" the answer is 1 in version 7 builds and 0 in version 6.4 builds: so it seems that the answer to your other question is also yes. Here is what I have in v7 $VIMRUNTIME/doc/term.txt under ":help term-cursor-shape" which is also ":help termcap-cursor-color":
*termcap-cursor-shape* *termcap-cursor-color* When Vim enters Insert mode the 't_SI' escape sequence is sent. When leaving Insert mode 't_EI' is used. But only if both are defined. This can be used to change the shape or color of the cursor in Insert mode. These are not standard termcap/terminfo entries, you need to set them yourself. Example for an xterm, this changes the color of the cursor:

Код: Выделить всё

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

NOTE: When Vim exits the shape for Normal mode will remain. The shape from before Vim started will not be restored. {not available when compiled without the +cursorshape feature}
Best regards, Tony.
Ich weiss, dass ich nichts weiss, aber wissen Sie es auch?
Завистники на что не взглянут,
подымут вечно лай,
А ты себе своей дорогою ступай,
Полают, да отстанут. Крылов
Спасибо сказали:
Ответить