让vim在solaris下面显示彩色

首先,要保证系统是可以显示彩色的
然后你的ssh终端也要支持彩色(比如putty)
终端类型改成xterm
然后照着下面这个修改.vimrc
 
"--------------------------------------------
" Vim
" An example for a vimrc file.
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"             for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM_vimrc
if &term == "xterm"
    set term=xtermc
endif
set background=dark
if &t_Co > 1
    syntax on
endif
"syntax on     " enable syntax highlighting!
set nocompatible    " Use Vim defaults (much better!)
set bs=2        " allow backspacing over everything in insert mode
set noai        " always set autoindenting on, turned off by Eugene
"set tw=78     " always limit the width of text to 78
"set backup        " keep a backup file
set viminfo='20,"50    " read/write a .viminfo file, don't store more
            " than 50 lines of registers
"set backupdir=~/tmp
map _g :let efsave=&ef<Bar>let &ef=tempname()<Bar>exe ':!grep -n -w "<cword>" *.[ch] >'.&ef<CR>:cf<CR>:exe ":!rm ".&ef<CR>:let &ef=efsave<Bar>unlet efsave<CR><CR>:cc<CR>
" Don't use Ex mode, use Q for formatting
map Q gq
augroup cprog
  " Remove all cprog autocommands
  au!
  " When starting to edit a file:
  "   For *.c and *.h files set formatting of comments and set C-indenting on.
  " C-indenting is turned off by Eugene
  "   For other files switch it off.
  "   Don't change the order, it's important that the line with * comes first.
  autocmd BufRead *       set formatoptions=tcql nocindent comments&
  autocmd BufRead *.c,*.h set formatoptions=croql comments=sr:/*,mb:*,el:*/,://
" autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
augroup END
augroup gzip
  " Remove all gzip autocommands
  au!
  " Enable editing of gzipped files
  "      read: set binary mode before reading the file
  "        uncompress text in buffer after reading
  "     write: compress file after writing
  "    append: uncompress file, append, compress file
  autocmd BufReadPre,FileReadPre    *.gz set bin
  autocmd BufReadPost,FileReadPost  *.gz '[,']!gunzip
  autocmd BufReadPost,FileReadPost  *.gz set nobin
  autocmd BufReadPost,FileReadPost  *.gz execute ":doautocmd BufReadPost " . %:r
  autocmd BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
  autocmd BufWritePost,FileWritePost    *.gz !gzip <afile>:r
  autocmd FileAppendPre         *.gz !gunzip <afile>
  autocmd FileAppendPre         *.gz !mv <afile>:r <afile>
  autocmd FileAppendPost        *.gz !mv <afile> <afile>:r
  autocmd FileAppendPost        *.gz !gzip <afile>:r
augroup END
set ruler
set gfn&
"-------------------------------
我想起作用的其实只是
if &term == "xterm"
    set term=xtermc
endif
set background=dark
if &t_Co > 1
    syntax on
endif
但是没有经过认真验证
 
thanks for webber's help

Leave a Reply

Your email address will not be published. Required fields are marked *