我附加了两张图片来展示我的 vim-powerline 的样子。
vim 正常模式 http://maprys.net/download/vim_normal.png
vim 插入模式 http://maprys.net/download/vim_insert.png
正如您所看到的,颜色发生了一些变化,我不知道如何修复它。
我正在全新安装并运行 Fedora 17,配备 i3(默认配置)和 urxvt。
这是我的 .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
和我的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
最后是我的 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
" ----------------------------
任何关于修复状态行的指导都非常好。我找到了一个github 问题概述了几乎完全相同的问题,但解决方案从未发布过。谢谢。
答案1
看起来urxvt
,至少 Fedora 存储库提供的版本无法输出 256 色。我运行了一个颜色测试验证urxvt
是否未显示 256 种颜色。Fedora 有一个单独的软件包,rxvt-unicode-256color
其中包含urxvt
256 种颜色支持。
要在 Fedora 中安装,请运行:
yum install rxvt-unicode-256color
新的可执行文件名为urxvt256c
。
i3
你可以用两种不同的方式连接它,
A。修改i3
配置:
bindsym $mod+Return exec i3-sensible-terminal
到
bindsym $mod+Return exec urxvt256c
或者B.通过将终端添加到此脚本查找的终端列表来进行修改/usr/bin/i3-sensible-terminal
(我选择了此选项) 。urxvt256c
for terminal in $TERMINAL urxvt256c urxvt rxvt ... ; do
我选择了选项 B,因为它使我的i3
配置更具可移植性,如果我把它放在没有的系统上,我仍然可以毫无困难地urxvt256c
启动终端。i3