我在 .vimrc 上设置的颜色方案不会在我每次启动 VIM 时加载。一旦我进入 VIM,输入:colo colourschemename配色方案就会完美加载。为什么启动 VIM 时不加载颜色方案。
我在我的 xterm 中启用了 256 种颜色。我有 CSApprox 插件
echo $TERM //report xterm-256terminal
tput colors//256
在 VIM 上:输入此命令
set t_Co? //256
另一件事是在 VIM中加载预装的配色方案可以完美运行。例如(晚上,沙漠等)
以前可以完美运行。在它出错之前我所做的事情。对不起,我是 Linux 的新手。
- 我已将 .Xdefaults 更改为具有相同内容的 .Xresources
*定制:-颜色
XTerm*termName: xterm-256color
- 我不小心通过输入 xrdb 然后按 CTRL-D 清除了 xrdb。如果我清除 xrdb 会很糟糕吗?之后我所做的是执行:
xrdb -merge $HOME/.Xresources
顺便说一句,在 Gvim 上,颜色方案正确加载。我正在使用 Ubuntu 12.04LTS
这是我在 $HOME/.vimrc 下的 .vimrc
"**********************************************"
" VUNDLE SETTINGS "
"**********************************************"
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
filetype plugin indent on " required!
"**********************************************"
" PLUGINS "
"**********************************************"
"EasyMotion
Bundle 'Lokaltog/vim-easymotion'
"Sparkup
Bundle 'tristen/vim-sparkup'
"Surround
Bundle 'tpope/vim-surround'
"CsApprox
Bundle 'godlygeek/csapprox'
"**********************************************"
" COLOR SCHEMES "
"**********************************************"
" Distinguised
Bundle 'Lokaltog/vim-distinguished'
" Github
Bundle 'endel/vim-github-colorscheme'
" VividChalk
Bundle 'tpope/vim-vividchalk'
" Pyte
Bundle 'therubymug/vim-pyte'
" Vibrantink
Bundle 'vim-scripts/vibrantink'
"**********************************************"
" MAP LEADER "
"**********************************************"
let mapleader = ","
"**********************************************"
" SYNTAX "
"**********************************************"
syntax enable
"**********************************************"
" VIM SCRIPTS "
"**********************************************"
if has('gui_running')
colorscheme github
else
colorscheme pyte
endif
"**********************************************"
" CUSTOM SETTINGS "
" "
"**********************************************"
set hidden
" Show what mode you're currently at
set showmode
" Enable enhanced command line completion
set wildmenu
" Don't redraw while executing macros
set lazyredraw
" Indentation settings (SOFT TABS)"
set shiftwidth=4
set softtabstop=4
set smarttab
set expandtab "enable this to use spaces instead of tabs
" show line number
set nu
" hightlight as you type
set incsearch
" ignore case when searching
set ignorecase
" set statusline
set laststatus=2
"**********************************************"
" NOTE don't map <c-s> and <c-q> "
"**********************************************"
"**********************************************"
" KEYMAPS "
"**********************************************"
"*******NORMAL MODE MAPPING********"
"map for editing .vimrc
nnoremap <leader>ev :e $MYVIMRC<cr>
"map for sourcing vimrc
nnoremap <leader>sv :so $MYVIMRC<cr>
"map for switching windows
"_ in this keymap is to jump for a line with a nonblank char
nnoremap <space> <c-w><c-w>_
"*******INSERT MODE Mapping********"
"map for escape while in insert mode
inoremap <leader>; <esc>
"map for ins-completion
inoremap <leader>x <c-x>
"*********COMMAND MODE Mappings*******
"exit out of command line mode
cnoremap <leader>; <c-c>
编辑
似乎确实加载了colorsheme。首次加载时,键入:colorscheme会报告我在 .vimrc 上设置的正确颜色方案。但它不会第一次生效。我必须在 VIM 上输入
:colo 'colorschemename'*
或再次使用它来激活颜色方案
:so $MYVIMRC
但是退出 VIM 后,colorscheme 再次没有生效,而是在启动 VIM 时加载。
我已经在终端上执行了这个:
/usr/share/terminfo/d/darwin-256x96
/usr/share/terminfo/d/darwin-256x96-m
/usr/share/terminfo/E/Eterm-256color
/usr/share/terminfo/p/putty-256color
/usr/share/terminfo/r/rxvt-unicode-256color
/usr/share/terminfo/r/rxvt-256color
/usr/share/terminfo/k/konsole-256color
/usr/share/terminfo/s/screen-256color-s
/usr/share/terminfo/s/screen-256color-bce-s
/usr/share/terminfo/g/gnome-256color
/usr/share/terminfo/v/vte-256color
/usr/share/terminfo/x/xnuppc+256x96
/usr/share/terminfo/x/xterm+256color
/usr/share/terminfo/x/xnuppc-256x96-m
/usr/share/terminfo/x/xnuppc-256x96
/usr/share/terminfo/m/mrxvt-256color
/usr/share/terminfo/m/mlterm-256color
注意:我已经安装了 ncurses-term。xterm 是xterm+256color而不是xterm-256color是否正确
顺便提一句。我已经编辑了我的问题。
提前致谢。