badwolf 配色方案在 ubuntu 14.04 上不起作用

badwolf 配色方案在 ubuntu 14.04 上不起作用

我想badwolf为我的 vim 使用配色方案,所以我从这里下载了它https://github.com/sjl/badwolf并复制colors/badwolf.vim到我的~/.vim/colors目录中。但它不起作用。它没有做任何更改。我现在有 Ubuntu 14.04,但是当我有 Ubuntu 15.04 和 Ubuntu 15.10(是的,由于一些问题,我不得不降级我的系统)时,情况完全一样,.vimrc而且badwolf可以正常工作。

我有 vim 版本 7.4.52,并且在我的.vimrc里面有一行color badwolf。我的uname -a

Linux dima-UX32LN 4.2.0-35-generic #40~14.04.1-Ubuntu SMP Fri Mar 18 16:37:35 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

我的 bash 版本:GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)

PS Ctrl+也End停止工作了。我无法用它导航到页面末尾。

我的终端(echo $COLORTERM)是gnome-terminal

更新

我的vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:32)
Included patches: 1-52
Modified by [email protected]
Compiled by buildd@
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl    -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions 

我的.vimrc

设置不兼容“得到改进,需要文件类型关闭”

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

Plugin 'tpope/vim-fugitive'
Plugin 'L9'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'Valloric/YouCompleteMe'

Plugin 'dag/vim2hs'

call vundle#end()            " required
filetype plugin indent on    " required

" YCM settings {{{
let g:clang_library_path = "/usr/lib64/"
let g:clang_complete_copen = 0
let g:clang_hl_errors = 1
let g:clang_snippets = 1
let g:clang_snippets_engine = "ultisnips"
let g:clang_close_preview = 1
let g:clang_complete_macros = 1

let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_use_ultisnips_completer = 1
let g:ycm_key_list_select_completion=[]
let g:ycm_key_list_previous_completion=[]

let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"
" }}}

syntax on

color badwolf
set cursorline
" hi CursorLine term=bold cterm=bold guibg=Grey40

let python_highlight_all = 1

set autoread
set ruler
set ignorecase
set incsearch
set number
set hlsearch " Enable search highlighting

set expandtab
set smarttab
set shiftwidth=4
set tabstop=4

set ai
set si

set encoding=utf8

set fileformat=unix
set ffs=unix,dos,mac

vnoremap <silent> # :call VisualSelection('b')<CR>

set laststatus=2

set pastetoggle=<F2>

map <F5> :edit!<cr>
map <c-s> :w<cr>
map <c-z> :undo<cr>
nmap \M :set noexpandtab tabstop=8 softtabstop=4 shiftwidth=4<CR>
nmap \t :set expandtab tabstop=4 softtabstop=4 shiftwidth=4<CR>

" open tagbar
nmap <F8> :TagbarToggle<CR>
" open nerdtree
nmap <F7> :NERDTreeToggle<CR>
" open it automatically
" autocmd vimenter * NERDTree

nnoremap <C-S-tab> :tabprevious<CR>
nnoremap <C-tab>   :tabnext<CR>
nnoremap <C-t>     :tabnew<CR>

au BufNewFile *.cpp 0r ~/.vim/template.cpp | let IndentStyle = "cpp"

command Compile !g++ -O2 -std=c++11 -Wall -Wextra -DLOCAL -Wpedantic %:t
execute pathogen#infect()
call pathogen#helptags()

答案1

终于找到了答案。问题是默认情况下全彩支持~/.bashrc~/.vimrc被禁用。我在 Ubuntu 15 上没有遇到这个问题。我在这里找到了解决办法:如何在 Vim 中启用全彩色支持?。所以我所要做的就是插入

if $COLORTERM == 'gnome-terminal'
    set t_Co=256
endif

在我的~/.vimrc

更新

正如@muru 所说,最好插入

if [ "$COLORTERM" == "gnome-terminal" ]; then
    export TERM=xterm-256color
fi

在你的.bashrc(请参阅上面链接中的原因)

相关内容