天天看點

vim配置檔案(本人喜歡的風格)

在/etc/vimrc這個檔案

if v:lang =~ "utf8$" || v:lang =~ "utf-8$"

   set fileencodings=utf-8,latin1

endif

set nu

set tabstop=4

set nocompatible " use vim defaults (much better!)

set bs=indent,eol,start " allow backspacing over everything in insert mode

"set ai " always set autoindenting on

"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 history=50 " keep 50 lines of command line history

set ruler " show the cursor position all the time

" only do this part when compiled with support for autocommands

if has("autocmd")

  augroup redhat

    " in text files, always limit the width of text to 78 characters

    autocmd bufread *.txt set tw=78

    " when editing a file, always jump to the last cursor position

    autocmd bufreadpost *

    \ if line("'\"") > 0 && line ("'\"") <= line("$") |

    \   exe "normal! g'\"" |

    \ endif

  augroup end

if has("cscope") && filereadable("/usr/bin/cscope")

   set csprg=/usr/bin/cscope

   set csto=0

   set cst

   set nocsverb

   " add any database in current directory

   if filereadable("cscope.out")

      cs add cscope.out

   " else add database pointed to by environment

   elseif $cscope_db != ""

      cs add $cscope_db

   endif

   set csverb

" switch syntax highlighting on, when the terminal has colors

" also switch on highlighting the last used search pattern.

if &t_co > 2 || has("gui_running")

  syntax on

  set hlsearch

if &term=="xterm"

     set t_co=8

     set t_sb=[4%dm

     set t_sf=[3%dm

highlight comment ctermfg=green guifg=green

繼續閱讀