Hi.
I was watching a speech on Youtube by Bram Moolenaar where he
recommended the use of vim over gvim for better switching between
editor/shell etc, much faster etc.
My only problem w/ a cterm-vim is that there is no pre-built clear
indicatorbetween insert and normal mode besides the "--INSERT--" text
on the status line.
Any suggestions?
I tried some ugly autocommand for the normal background highlighting
like tehse:
au Insertleave * highlight Normal ctermbg=gray
au Insertenter * highlight Normal ctermbg=white
well, what i discovered is that "white" is basically gray on my term
(xterm or ansi) for some reason (using the latest Ubuntu), but i don't
know how to fix it. the xterm-vim page was too abstract and didn't
have clear examples, not to mention the man pages.
> My only problem w/ a cterm-vim is that there is no pre-built clear > indicator between insert and normal mode besides the "--INSERT--" > text on the status line.
> Any suggestions?
To remind myself what mode I'm in I have the text-cursor change color, using the following in my vimrc. Note that the ^[ and ^G here are not literal two-character combinations (ie, can't just cut & paste those parts), but Escape and Ctrl-G formed by pressing Ctrl-V then escape, and Ctrl-V then Ctrl-G respectively.
" text-cursor color by mode in xterm, linux console and screen.linux console: " normal mode = golden, insert mode = green, return to green when leaving vim if &term =~ "xterm" :silent !echo -ne "\033]12;GoldenRod\007" set t_SI+=^[]12;green^G set t_EI+=^[]12;GoldenRod^G autocmd VimLeave * :!echo -ne "\033]12;green\007" " show 'Vim, filename' in xterm title bar set titlestring=\%(\%M%)%t\ (Vim) " Set xterm to 16 colors (don't I want more?) set t_Co=16 endif if &term == "linux" && !has("gui_running") set t_ve+=^[[?17;183;95c " yellow au InsertEnter * set t_ve+=^[[?17;207;111c " green au InsertLeave * set t_ve+=^[[?17;183;95c " yellow autocmd VimLeave * set t_ve+=^[[?17;207;111c " green endif if &term == "screen.linux" set t_ve+=^[[34l au InsertEnter * set t_ve+=^[[34h^[[?25h " cnorm au InsertLeave * set t_ve+=^[[34l " cvvis autocmd VimLeave * set t_ve+=^[[34h^[[?25h " show 'V:filename' as window name for screen (Tip 1126) set titlestring=\%(\%M%)V:%t set t_ts=^[k set t_fs=^[\ endif
> To remind myself what mode I'm in I have the text-cursor change color,
> using the following in my vimrc. Note that the ^[ and ^G here are not
> literal two-character combinations (ie, can't just cut & paste those
> parts), but Escape and Ctrl-G formed by pressing Ctrl-V then escape,
> and Ctrl-V then Ctrl-G respectively.
One problem i have is that the curosor is blinking so it still take
about a second to see the new color, how to stop it?
> " text-cursor color by mode in xterm, linux console and screen.linux console:
> " normal mode = golden, insert mode = green, return to green when leaving vim
> if &term =~ "xterm"
> :silent !echo -ne "\033]12;GoldenRod\007"
> set t_SI+=^[]12;green^G
> set t_EI+=^[]12;GoldenRod^G
> autocmd VimLeave * :!echo -ne "\033]12;green\007"
> " show 'Vim, filename' in xterm title bar
> set titlestring=\%(\%M%)%t\ (Vim)
> " Set xterm to 16 colors (don't I want more?)
> set t_Co=16
> endif
> if &term == "linux" && !has("gui_running")
> set t_ve+=^[[?17;183;95c " yellow
> au InsertEnter * set t_ve+=^[[?17;207;111c " green
> au InsertLeave * set t_ve+=^[[?17;183;95c " yellow
> autocmd VimLeave * set t_ve+=^[[?17;207;111c " green
> endif
> if &term == "screen.linux"
> set t_ve+=^[[34l
> au InsertEnter * set t_ve+=^[[34h^[[?25h " cnorm
> au InsertLeave * set t_ve+=^[[34l " cvvis
> autocmd VimLeave * set t_ve+=^[[34h^[[?25h
> " show 'V:filename' as window name for screen (Tip 1126)
> set titlestring=\%(\%M%)V:%t
> set t_ts=^[k
> set t_fs=^[\
> endif
why all this branching? are all terminals quering the same db
(terminfo?)?
thanks>
> To remind myself what mode I'm in I have the text-cursor change color,
> using the following in my vimrc. Note that the ^[ and ^G here are not
> literal two-character combinations (ie, can't just cut & paste those
> parts), but Escape and Ctrl-G formed by pressing Ctrl-V then escape,
> and Ctrl-V then Ctrl-G respectively.
One problem i have is that the curosor is blinking so it still take
about a second to see the new color, how to stop it?
> " text-cursor color by mode in xterm, linux console and screen.linux console:
> " normal mode = golden, insert mode = green, return to green when leaving vim
> if &term =~ "xterm"
> :silent !echo -ne "\033]12;GoldenRod\007"
> set t_SI+=^[]12;green^G
> set t_EI+=^[]12;GoldenRod^G
> autocmd VimLeave * :!echo -ne "\033]12;green\007"
> " show 'Vim, filename' in xterm title bar
> set titlestring=\%(\%M%)%t\ (Vim)
> " Set xterm to 16 colors (don't I want more?)
> set t_Co=16
> endif
> if &term == "linux" && !has("gui_running")
> set t_ve+=^[[?17;183;95c " yellow
> au InsertEnter * set t_ve+=^[[?17;207;111c " green
> au InsertLeave * set t_ve+=^[[?17;183;95c " yellow
> autocmd VimLeave * set t_ve+=^[[?17;207;111c " green
> endif
> if &term == "screen.linux"
> set t_ve+=^[[34l
> au InsertEnter * set t_ve+=^[[34h^[[?25h " cnorm
> au InsertLeave * set t_ve+=^[[34l " cvvis
> autocmd VimLeave * set t_ve+=^[[34h^[[?25h
> " show 'V:filename' as window name for screen (Tip 1126)
> set titlestring=\%(\%M%)V:%t
> set t_ts=^[k
> set t_fs=^[\
> endif
why all this branching? are all terminals quering the same db
(terminfo?)?
thanks>
is it suppose to change color 4? can i set highlighting ctermfg=4?
it still didn't work?
i wish i could just change the term settings, or modify one to work
for vim,sure it must be some script for that..
there is sure a "capability" to change to shape of the cursor, as it
ahppens many times on the shell, don't remember when, so i wish i
could just change the term definition and use it both for vim and zsh
to indicate mode changing.
im sure many have fixed it in their vimrc, and sure if you master
terminfo, it is a simple and easy command. So what is?
> you have to run xrdb or restart x to take effect.
> BTW ubuntu does not use xterm as its default term emulator as far as I know.
set term? gives me xterm.
i haven't change it manually.
On 2011-04-03, ale wrote: > On Apr 3, 12:05 pm, bill lam wrote: > > to change colors in xterm, you create or amend ~/.Xresource and add lines > > such as,
> > ! change darkblue brighter > > XTerm*VT100*color4: #0088ff > is it suppose to change color 4? can i set highlighting ctermfg=4? > it still didn't work?
First off, that file name is spelled .Xresources, with an s at the end.
Next, for changes to the ~/.Xresources or ~/.Xdefaults file to take effect, the file has to be read by the X resource database manager. This is done automatically when your window manager starts. If you want changes made to that file to take effect without restarting your window manager, you'll have to run 'xrdb', like this:
On Sun, Apr 03, 2011 at 05:37:05AM -0700, ale wrote:
> set term? gives me xterm. > i haven't change it manually.
Given that, and some proposed solutions which might not be so easy for everyone to maintain long term, due to complexity, I'll offer what is working for me, in an xterm. (So far, anyway. :-) In .vimrc:
" Appearance: (Insert_Mode == Green, Normal_Mode == Red) if &term =~ "xterm" let &t_SI = "\<Esc>]12;green\x7" let &t_EI = "\<Esc>]12;red\x7" endif
I've only had it in place for a month or so, but haven't yet had any surprises. It does take a second to change to red on exit from insert mode, but I can usually remember that long what I've done. YMMV.
Erik
-- Do not do unto others as you would they should do unto you. Their tastes may not be the same. - George Bernard Shaw