You are not logged in.
Hi. I recently got a shell account from Kaitocracy on his linode machine. I noticed that my bash prompt has color, as expected, but when I copied over my vim configuration (which includes a color theme), it didn't work! After some toying around, I noticed that vim recognizes the terminal escape codes using `:hi <type> start= stop=`, but not the existing `cterm` commands in my color theme. To make things more confusing, I know my terminal (urxvt) is capable of using the cterm flags.
Also, Ctrl+L does not clear/redraw the screen as expected.
What can I do to fix these issues? Here are the configs:
~/.vimrc:
" No vi compatibility; strictly vim here.
set nocompatible
" Don't source /etc/vimrc
set noexrc
" My background is always black
set background=dark
" The mouse is helpful every now and then...
set mouse=a
" I'm a Linux user
set fileformats=unix,dos,mac
" Search while I type
set incsearch
" The blinking pisses me off
set novisualbell
" Line numbers are key to debugging
set number
set numberwidth=5
" My tabs are 4 characters long
set tabstop=4
set softtabstop=4
" Indention is also 4 characters
set shiftwidth=4
" Normally, I don't want tabs converted to spaces.
set noexpandtab
" Syntax highlighting is a staple :D
syntax on
" I want liberal use of hidden buffers, just in case.
set hidden
set laststatus=2
" filename, filetype, readonly flag, modified flag line #, column #, %age of file length, hex value of byte under cursor.
" Ex: .vimrc [vim][+] 48,22 55% hex:20
set statusline=%f\ %y%r%m\ %l,%c\ %P\ hex:%B
set noai
" I can see where tabs and line endings are
set listchars=tab:▸\ ,eol:¬
" This turns on the config above; I can turn it off with :set nolist
set list
" I want wordwrap on, coupled with sane line-breaking. This will not work when :set list is active.
set wrap
set lbr
" My color scheme is pwn
colorscheme sporkbox
filetype indent on
if has("autocmd")
" enable filetype detection
filetype on
" I want to convert tabs to spaces to adhere to PEP 8.
autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
endif
" \l toggles invisibles
nmap <leader>l :set list!<CR>
" I like to get rid of trailing white space.
nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
" Fast window movement is important
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Courtesy of vimcasts.org
function! <SID>StripTrailingWhitespaces()
" Save last search and cursor position
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Restore previous search history and cursor position
let @/=_s
call cursor(l, c)
endfunction
~/.vim/colors/sporkbox.vim:
" Color scheme "sporkbox"
" by Daniel Campbell <danny@sporkbox.us>
" Tab characters and EOLs should be dark gray so they don't stand out too much.
highlight SpecialKey ctermfg=darkgray
highlight NonText ctermfg=darkgray
" If I'm in a mode, I want to see it.
highlight ModeMsg ctermfg=green
" The current file should be obvious; the others can be faded.
highlight StatusLine ctermfg=green ctermbg=black
highlight StatusLineFC ctermfg=darkgray ctermbg=white
" Line numbers should be just-visible, not bright.
highlight LineNr ctermfg=darkgray
" Titles in Markdown
highlight Title cterm=bold ctermfg=white
" My splits should not be bright
highlight VertSplit ctermfg=black ctermbg=darkblue
highlight Comment ctermfg=darkgreen
highlight Constant ctermfg=cyan
highlight Identifier ctermfg=yellow
highlight Statement ctermfg=magenta
highlight PreProc ctermfg=lightblue
highlight Type ctermfg=blue
highlight Special ctermfg=lightblue
Remote .bashrc:
### ~/.bashrc: Sourced by all interactive bash shells on startup
# Set a fancier prompt
PS1='\[\e[32;01m\]\u\[\e[m\] \[\e[36m\]\w\[\e[m\]: '
# Turn on colors for ls and grep
alias less='less --RAW-CONTROL-CHARS'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# Set colors for ls and friends
if [ -f ~/.dir_colors ]; then
eval `dircolors -b ~/.dir_colors`
elif [ -f /etc/dir_colors ]; then
eval `dircolors -b /etc/dir_colors`
else eval `dircolors -b`; fi
# Compilation optimization flags
CHOST="i686-pc-linux-gnu"
MAKEFLAGS="-j2"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=both"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
FFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CPPFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
export PGHOST="private1.kiwilight.com"
export PS1 CHOST MAKEFLAGS LDFLAGS CFLAGS FFLAGS CXXFLAGS
To make matters more confusing, my vim theme works when I connect to the linode in a GNU screen session, but not when it's a straight-up terminal.
Last edited by xelados (2010-04-25 00:34:44)
Offline
I'm guessing it has something to do with the remote machine's $TERM...?
Offline
Both report correctly; screen reports $TERM as "screen" and a plain urxvt reports as "rxvt-unicode"
Offline
Hi xelados: For vim you might want:
set t_Co=256
or something similar (some other # of colors.)
HTH
Offline
Interesting; when I manually export $TERM as "screen", the colors show up fine despite not being inside a screen session. Why is this behavior happening? I've poured over all my user files and haven't seen anything relating to it.
Offline
Are you sure "screen" works as $TERM?
What if you export $TERM to "screen-256color" ?
As to why it works that way - read about termcap and terminfo (and see how retarded that approach is)
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Make sure you are using rxvt-unicode-256color and that your TERM is rxvt-256color outside of screen, and screen-256color inside of screen.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Make sure you are using rxvt-unicode-256color and that your TERM is rxvt-256color outside of screen, and screen-256color inside of screen.
That's the peculiarity of the problem; when I run vim in my local environment, I always get color using the `:hi <hilighttype> ctermfg=* ctermbg=*` commands. This applies inside of X through rxvt-unicode (non-256color), GNU screen, and on the plain command line in vc1. This issue seems to be related to the remote environment and/or variables not being sent through ssh.
@moljac: When I echo'd TERM inside a screen session, it returned "screen", so I don't know whether it's legit or not.
Last edited by xelados (2010-04-24 11:47:52)
Offline
Do you actually have a terminfo for rxvt-unicode on the remote machine?
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
I don't know; how do I check?
Offline
The manual for terminfo
makes it very clear
that all you have to do is
point your file browser over here,
where here = /usr/share/terminfo/
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
It seems that the admin of the box installed urxvt since others were having the same issue. all works fine now..
Thanks for the information; I know where to look if I have the same issue in the future.
Offline