A Few Issues with the non-gui vim

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

A Few Issues with the non-gui vim

aleCodd
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.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

bill lam
to change colors in xterm, you create or amend ~/.Xresource and add lines
such as,

! change darkblue brighter
XTerm*VT100*color4: #0088ff

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.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

John Magolske
In reply to this post by aleCodd
* ale <[hidden email]> [110402 17:47]:
> 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

Regards,

John

--
John Magolske
http://B79.net/contact

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

aleCodd


On Apr 3, 12:12 pm, John Magolske <[hidden email]> wrote:
> * ale <[hidden email]> [110402 17:47]:
>
> 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>
> --
> John Magolskehttp://B79.net/contact

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

aleCodd
In reply to this post by John Magolske


On Apr 3, 12:12 pm, John Magolske <[hidden email]> wrote:
> * ale <[hidden email]> [110402 17:47]:
>
> 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>
> --
> John Magolskehttp://B79.net/contact

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

aleCodd
In reply to this post by bill lam


On Apr 3, 12:05 pm, bill lam <[hidden email]> 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?
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.
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

John Magolske
In reply to this post by aleCodd
* ale <[hidden email]> [110403 08:57]:
> On Apr 3, 12:12 pm, John Magolske <[hidden email]> wrote:
> > * ale <[hidden email]> [110402 17:47]:
> >
> > To remind myself what mode I'm in I have the text-cursor change color,
>
> 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?

Probably a termcap setting. What console are you using?

[...]

> why all this branching? are all terminals quering the same db
> (terminfo?)?

I have three conditions set for the three terms I use, Xterm, linux
and screen.linux, which all require different control sequences.

John

--
John Magolske
http://B79.net/contact

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

Gary Johnson-4
In reply to this post by aleCodd
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:

    $ xrdb -merge ~/.Xresources

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: A Few Issues with the non-gui vim

Erik Christiansen
In reply to this post by aleCodd
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

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php