You are not logged in.
For instance visual selection is set up to change fg/bg to black/green but changes fg to green. Under x using urxvt it displays correctly.
Last edited by Noble (2010-07-26 21:22:19)
Those who give up their liberty for security,
neither deserve liberty nor freedom,
and they will lose both.
- Benjamin Franklin
Offline
I believe I have had this problem as well. Let me ask you, are you trying to use some of the .vim files from
http://code.google.com/p/vimcolorschemetest/
for instance?
If so, the problem is due to most .vim files being useful only in gvim and not tty vim.
It is possible to use these .vim files under vim run on urxvt (I do this now), but you have to do the following:
1) Select a small set of .vim files that you like.
2) Re-write those files to be compatible with a terminal version of vim
3) Re-configure urxvt to use the colors specified by your chosen .vim file
This sounds like quite a bit of monkeying around, and in fact there is quite a lot to do. I wrote a python script that does all this. It's about 350 lines of python in a single file. If you were interested I could post the file. You would basically have to run the script just once, and from then on everything would be configured. If you decided you wanted to use a different .vim file, then you would need to run the script again.
Offline
I have written my own syntax highlight theme, post below. If you think your script could do anything about it after looking at the file please post But as I said, vim works fine in urxvt, but not when I switch out of X and run it in the vc/tty.
:set statusline=#%n\ %y\ %F\ %r\ %=%c\ %l/%L
:set hlsearch
:set nocompatible
:set noexrc
:set number
:syntax enable
:set autochdir
:set backup
:set backupdir=~/.vim/backup
:set directory=~/.vim/tmp
:set autoindent
:set ruler
:set nowrap
:set nocp
:set scrolloff=5
:set sidescrolloff=5
:set fileformats=unix,dos,mac
:set title
:set laststatus=2
:set tabstop=4
:set autoread
:set showcmd
:set showmatch
:set shiftwidth=4
:set smarttab
:set backspace=indent,eol,start
filetype on
filetype plugin on
filetype indent on
hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
highlight ErrorMsg ctermfg=red ctermbg=none cterm=bold
highlight WarningMsg ctermfg=red ctermbg=none cterm=bold
highlight VertSplit ctermfg=green ctermbg=black
highlight Folded ctermfg=magenta ctermbg=none
highlight FoldColumn ctermfg=magenta ctermbg=none
highlight FoldColumn ctermfg=magenta
highlight LineNr ctermfg=green cterm=bold
highlight ModeMsg ctermfg=lightgreen cterm=bold
highlight MatchParen ctermfg=black ctermbg=green
highlight Normal ctermfg=white ctermbg=none
highlight SignColumn ctermfg=magenta
highlight NonText ctermfg=blue
highlight Question ctermfg=red cterm=bold
highlight Comment ctermfg=8
highlight Constant ctermfg=green cterm=none
highlight Identifier ctermfg=white cterm=bold
highlight Statement ctermfg=lightgreen cterm=bold
highlight PreProc ctermfg=10
highlight Type ctermfg=2
highlight Special ctermfg=cyan
highlight Error ctermfg=red ctermbg=none
highlight Todo ctermfg=yellow ctermbg=none cterm=bold
highlight StatusLine ctermfg=black ctermbg=green cterm=none
highlight StatusLineNc ctermfg=black ctermbg=lightgreen cterm=none
highlight Directory ctermfg=white
highlight Search ctermfg=black ctermbg=green cterm=none
highlight Visual ctermfg=black ctermbg=lightgreen
highlight WildMenu ctermfg=black ctermbg=cyan cterm=none
highlight Pmenu ctermfg=black ctermbg=green
highlight PmenuSel ctermfg=black ctermbg=lightgreen cterm=none
Those who give up their liberty for security,
neither deserve liberty nor freedom,
and they will lose both.
- Benjamin Franklin
Offline
Try something like this:
http://git.cinderwick.ca/?p=vimbrant.gi … 20;hb=HEAD
Offline
Tried it but alas, no luck. It did change the colors of my tty/vc, but the background property does still not work.
Those who give up their liberty for security,
neither deserve liberty nor freedom,
and they will lose both.
- Benjamin Franklin
Offline
Noble, I see I misunderstood your problem.
I have a couple of things you could try.
From your console, type:
$echo $TERM
this should show what type of terminal your console is. On my machine it is 'linux'.
Next, type:
$tput colors
This will tell you the number of colors your terminal is capable of displaying. My console has 8 colors. As I read through the online vim help, I noticed a comment that said something like setting the attributes for background colors doesn't always work on 8-color terminals. (To read for yourself, start vim then type ':help ctermfg'.) To me, this appears to be your probem. I'm not sure, though, and I don't know what you could do about that.
Another thing you could try. From your console, type:
$tput setaf | hexdump -C
$tput setab | hexdump -C
This will show you the escape sequences needed to set the colors (foreground and background) for your terminal. On my console, I get the following output:
$tput setab | hexdump -C
00000000 1b 5b 34 25 70 31 25 64 6d |.[4%p1%dm|
00000009
$tput setaf | hexdump -C
00000000 1b 5b 33 25 70 31 25 64 6d |.[3%p1%dm|
00000009
From this you can see the escape sequences needed to set the foreground and background colors for your console. To get vim to use these sequences, put the following in your .vimrc (you should make a copy of your .vimrc file before doing this, in case it screws things up):
if term == linux
set t_ab=^[[4%p1%dm
set t_af=^[[3%p1%dm
endif
Note: in the above text, the appearent 2 character sequence "^[" is, in fact, the single ascii escape character. If you type the above verbatim, it will not work. Instead of typing the "^[", type (in insert mode) 'ctrl-v' followed by the escape key. You should see vim insert a ^[ in your text.
I don't expect this will work for you as it appears that vim can't set the background on 8 color terminals, but you can give it a shot.
Offline
Thanks for a very helpful and descriptive post rockin turtle.
I tried everything mentioned above, and some mixes of them. Suddly, it worked! I removed bit by bit, and without any color hacks at all I had a working line in my config!
highlight Visual ctermfg=white ctermbg=green cterm=bold
the strang thing is that its not different from what I had, and that the added cterm=bold seems to have done the trick!
Well well, I learned a lot about terminals and colors
Cheers!
Those who give up their liberty for security,
neither deserve liberty nor freedom,
and they will lose both.
- Benjamin Franklin
Offline