我一直在使用 ubuntu 的最新 vim,然后我重新格式化了我的计算机(但 /home 仍然相同),然后我安装了 archlinux 的最新 vim,不知何故颜色突出显示不再起作用,有没有办法找出问题所在?
编辑:我的 vim --version
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 5 2013 22:52:17)
Included patches: 1-798
Compiled by ArchLinux
Huge version with GTK2 GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall
+linebreak +lispindent +listcmds +localmap +lua +menu +mksession +modify_fname
+mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm
+mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang
-mzscheme +netbeans_intg +path_extra +perl +persistent_undo +postscript
+printer +profile +python -python3 +quickfix +reltime +rightleft +ruby
+scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop
+syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
+X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng15 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/local/include -march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lnsl -lacl -lattr -lgpm -ldl -L/usr/lib -llua -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
我的 .vimrc
$ cat .vimrc
" Vundle: https://github.com/gmarik/vundle
" installation: vim +BundleInstall +qall
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" installer
Bundle 'gmarik/vundle'
" ruby, rails
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-rails'
" folder tree
Bundle 'scrooloose/nerdtree'
" folder tree with tabs
Bundle 'jistr/vim-nerdtree-tabs'
" recover unsaved files
Bundle 'chrisbra/Recover.vim'
" find everything, use <Leader\>T or <Leader\>B
Bundle 'wincent/Command-T'
" change matching pair, use :cs[from][to]
Bundle 'tpope/vim-surround'
" expand snippet, use <tab>
Bundle 'msanders/snipmate.vim'
Bundle 'ervandew/supertab'
" easy jump, use <Leader\><Leader\>[char]
Bundle 'Lokaltog/vim-easymotion'
" syntax tree, use Ctrl+B
Bundle 'majutsushi/tagbar'
" split screen, use :ConqueTerm or :ConqueTermTab or :ConqueTermSplit or :ConqueTermVSplit [cmd]
Bundle 'rson/vim-conque'
" autocomplete for tag
"Bundle 'simple-pairs' " broken after upgrade on arch
" indentation guides
Bundle 'nathanaelkane/vim-indent-guides'
" ruby's end on every statement
Bundle 'tpope/vim-endwise'
" MRU, use ctrl+P
Bundle 'kien/ctrlp.vim'
" statusbar
Bundle 'Lokaltog/vim-powerline'
" autocomplete
"Bundle 'Valloric/YouCompleteMe'
" javascript, html5, jquery, css3:
Bundle 'pangloss/vim-javascript'
Bundle 'othree/html5.vim'
Bundle 'jQuery'
Bundle 'indenthtml.vim'
Bundle 'mutewinter/vim-css3-syntax'
filetype plugin indent on
" show hidden in nerdtree
" let NERDTreeShowHidden=1
" t: Open the selected file in a new tab
" i: Open the selected file in a horizontal split window
" s: Open the selected file in a vertical split window
" I: Toggle hidden files
" m: Show the NERD Tree menu
" R: Refresh the tree, useful if files change outside of Vim
" ?: Toggle NERD Tree's quick help
" auto open nerdtree-tabs in console
let g:nerdtree_tabs_open_on_console_startup=1
" auto close when no other window except nerd tree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" shortcut for nerdtree is Ctrl+n ==> normally :NERDTreeToggle<CR>
map <C-n> <C-w><C-w>
" shortcut for switching tab is Ctrl+Up/Ctrl+Down
map <C-Up> :tabn<CR>
map <C-Down> :tabp<CR>
" tagbar toggle
nmap <C-b> :TagbarToggle<CR>
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'F:singleton methods'
\ ]
\ }
" from stackoverflow forum
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
" open shell Ctrl+M
map <C-M> :ConqueTermSplit bash<CR>
" let conque close when bash ends, doesn't work
" let g:ConqueTerm_CloseOnEnd = 1
" autocomplete maps to Ctrl+space
imap <C-Space> <C-x><C-o>
imap <C-@> <C-Space>
" Ctrl+Backspace is delete previous word, need to patch libvte
imap <C-BS> <C-W>
" Ctrl+Shift+Up/Down to move current line
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
function! s:swap_up()
let n = line('.')
if n == 1
return
endif
call s:swap_lines(n, n - 1)
exec n - 1
endfunction
function! s:swap_down()
let n = line('.')
if n == line('$')
return
endif
call s:swap_lines(n, n + 1)
exec n + 1
endfunction
noremap <silent> <c-s-up> :call <SID>swap_up()<CR>
noremap <silent> <c-s-down> :call <SID>swap_down()<CR>
" map common mistakes
:command WQ wq
:command Wq wq
:command W w
:command Q q
" auto indent
" use :set paste or :set nopaste for pasting without/with autoindent
set shiftwidth=2
set tabstop=2
set smartindent
set expandtab
" CUT = Ctrl+X / Shift+Del
" COPY = Ctrl+C / Ctrl+Ins
" PASTE = Ctrl+V / Shift+Ins
" VISUAL = Ctrl+Q
" SAVE = Ctrl+S
" UNDO = Ctrl+Z
" REDO = Ctrl+Y
" MENU = Alt+Space
" SELECT ALL = Ctrl+A
" NEXT TAB = Ctrl+Tab
" CLOSE WINDOW = Ctrl+F4
source $VIMRUNTIME/mswin.vim
behave mswin
set t_Co=256
set background=dark
set syntax=on
set showmatch
set shiftwidth=2
set tabstop=2
set hlsearch
set backspace=indent,eol,start
colorscheme heraldkyz
我的术语环境变量:
$ echo $TERM
xterm-256色
答案1
这是 archlinux 上的 vim 包的问题..
注意:vim 软件包旨在尽可能轻量;因此,它不支持 Python、Lua 和 Ruby 解释器,也不支持 X 服务器选项(这意味着它不支持从 X 剪贴板复制和粘贴)。如果您需要这些选项,请安装 gvim 软件包(它也包含 vim 二进制文件)。
来源:https://wiki.archlinux.org/index.php/Vim
你必须安装 gvim 包