3

I have attached two images showing what my vim-powerline looks like.

vim normal mode http://maprys.net/download/vim_normal.png

vim insert mode http://maprys.net/download/vim_insert.png

As you can see, something has happened to the colors and I cannot figure out how to fix it.

I'm running Fedora 17 on a clean install with i3 (default config) and urxvt.

Here is my bashrc:

# .bashrc

if [[ "$(uname)" != "Darwin" ]]; then # non mac os x

    # source global bashrc
    if [[ -f "/etc/bashrc" ]]; then
        . /etc/bashrc
    fi

    export TERM='xterm-256color' # probably shouldn't do this
fi

# bash prompt with colors
# [ <user>@<hostname> <working directory> {current git branch (if you're in a repo)} ]
# ==>
PS1="\[\e[1;33m\][ \u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;33m\] \W\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/ {\[\e[1;36m\]\1\[\e[1;33m\]}/') ]\[\e[0m\]\n==> "

# execute only in Mac OS X
if [[ "$(uname)" == 'Darwin' ]]; then

    # if OS X has a $HOME/bin folder, then add it to PATH
    if [[ -d "$HOME/bin" ]]; then
        export PATH="$PATH:$HOME/bin"
    fi

    alias ls='ls -G' # ls with colors

fi

alias ll='ls -lah' # long listing of all files with human readable file sizes
alias tree='tree -C' # turns on coloring for tree command
alias mkdir='mkdir -p' # create parent directories as needed
alias vim='vim -p' # if more than one file, open files in tabs

export EDITOR='vim'

# super-secret work stuff
if [[ -f "$HOME/.workbashrc" ]]; then
    . $HOME/.workbashrc
fi

# Add RVM to PATH for scripting
if [[ -d "$HOME/.rvm/bin" ]]; then # if installed
    PATH=$PATH:$HOME/.rvm/bin
fi

and my Xdefaults:

! URxvt config

! colors!
URxvt.background:           #101010
URxvt.foreground:           #ededed
URxvt.cursorColor:          #666666
URxvt.color0:               #2E3436
URxvt.color8:               #555753
URxvt.color1:               #993C3C
URxvt.color9:               #BF4141
URxvt.color2:               #3C993C
URxvt.color10:              #41BF41
URxvt.color3:               #99993C
URxvt.color11:              #BFBF41
URxvt.color4:               #3C6199
URxvt.color12:              #4174FB
URxvt.color5:               #993C99
URxvt.color13:              #BF41BF
URxvt.color6:               #3C9999
URxvt.color14:              #41BFBF
URxvt.color7:               #D3D7CF
URxvt.color15:              #E3E3E3

! options
URxvt*loginShell:           true
URxvt*font:                 xft:DejaVu Sans Mono for Powerline:antialias=true:size=12
URxvt*saveLines:            8192
URxvt*scrollstyle:          plain
URxvt*scrollBar_right:      true
URxvt*scrollTtyOutput:      true
URxvt*scrollTtyKeypress:    true
URxvt*urlLauncher:          google-chrome

and finally my vimrc

set nocompatible
set dir=~/.vim/ " set one place for vim swap files

" vundler for vim plugins ----
filetype off

set rtp+=~/.vim/bundle/vundle
call vundle#rc()

Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'greyblake/vim-preview'
Bundle 'Lokaltog/vim-powerline'
Bundle 'tpope/vim-endwise'
Bundle 'kien/ctrlp.vim'
" ----------------------------

syntax enable
filetype plugin indent on

" Powerline ------------------
set noshowmode
set laststatus=2
let g:Powerline_symbols = 'fancy' " show fancy symbols (requires patched font)
set encoding=utf-8
" ----------------------------

" ctrlp ----------------------
let g:ctrlp_open_multiple_files = 'tj' " open multiple files in additional tabs
let g:ctrlp_show_hidden = 1 " include dotfiles and dotdirs in ctrlp indexing

let g:ctrlp_prompt_mappings = {
    \ 'AcceptSelection("e")': ['<c-t>'],
    \ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ } " remap <cr> to open file in a new tab
" ----------------------------

set showcmd

set tabpagemax=100

set hlsearch
set incsearch
set nowrapscan

set ignorecase
set smartcase

set ruler

set tabstop=4
set shiftwidth=4
set expandtab

set wildmode=list:longest

autocmd BufWritePre * :%s/\s\+$//e "remove trailing whitespace

" :REV to "revert" file to state of the most recent save
command REV earlier 1f

" disable netrw --------------
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
" ----------------------------

Any guidance as to fixing the statusline would be fantastic. I've found a github issue outlining almost the exact same problem, but the solution was never posted. Thank you.

2
  • what is your locale in urxvt?
    – romainl
    Dec 15, 2012 at 21:13
  • @romainl I don't explicitly set urxvt's locale, but my system is on en_US.UTF-8
    – komidore64
    Dec 15, 2012 at 23:20

1 Answer 1

3

It appears that urxvt, at least the one supplied from Fedora's repositories, cannot output in 256 colors. I ran a colortest to verify urxvt was not displaying 256 colors. Fedora has a separate package rxvt-unicode-256color containing urxvt with 256 color support.

To install in Fedora, run:

yum install rxvt-unicode-256color

The new executable is called urxvt256c.

You can hook it up to i3 in two different ways,

A. modify the i3 config from:

bindsym $mod+Return exec i3-sensible-terminal

to

bindsym $mod+Return exec urxvt256c

or B. modify /usr/bin/i3-sensible-terminal (I chose this option) by adding urxvt256c to the list of terminals this script looks up.

for terminal in $TERMINAL urxvt256c urxvt rxvt ... ; do

I chose option B because it makes my i3 config more portable, in case I put it on a system that doesn't have urxvt256c, I can still launch a terminal from i3 without any trouble.

4
  • The colortest script does not work: it does not display colors, but only the table uncolored. It's probably missing escape codes which were lost when pasting it here? btw: if you're building urxvt from source, make sure to pass --enable-256-color!
    – blueyed
    Oct 20, 2014 at 17:30
  • @blueyed, ah yes, you're correct. It looks like the shell escape codes disappeared when pasting into the comment. I will provide a link to the Gist instead.
    – komidore64
    Jul 9, 2015 at 15:28
  • 1
    I've recently found the following nice tool: github.com/scizzorz/termcolors
    – blueyed
    Jul 10, 2015 at 12:01
  • If you use Gentoo package enable 256-color USE flag.
    – Yuri
    Sep 16, 2019 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .