linux 配置vim 的 tab 和空行 color

來源:互聯網
上載者:User

centos 的位置在:/etc/vimrc

  1 if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
  2    set fileencodings=ucs-bom,utf-8,latin1
  3 endif
  4 syn on
  5 set number
  6 set nocompatible        " Use Vim defaults (much better!)
  7 set bs=indent,eol,start         " allow backspacing over everything in insert mode
  8 "set ai                 " always set autoindenting on
  9 "set backup             " keep a backup file
 10 set viminfo='20,\"50    " read/write a .viminfo file, don't store more
 11                         " than 50 lines of registers
 12 set history=50          " keep 50 lines of command line history
 13 set ruler               " show the cursor position all the time
 14 set listchars=tab:>-,trail:-
 15 highlight WhitespaceEOL ctermbg=red guibg=red

 16 match WhitespaceEOL /\s\+$/
 17 " Only do this part when compiled with support for autocommands
 18 if has("autocmd")
 19   augroup redhat
 20   autocmd!
 21   " In text files, always limit the width of text to 78 characters
 22   autocmd BufRead *.txt set tw=78
 23   " When editing a file, always jump to the last cursor position
 24   autocmd BufReadPost *
 25   \ if line("'\"") > 0 && line ("'\"") <= line("$") |
 26   \   exe "normal! g'\"" |
 27   \ endif
 28   " don't write swapfile on most commonly used directories for NFS mounts or USB sticks
 29   autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
 30   " start with spec file template
 31   autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
 32   augroup END
 33 endif
 34
 35 if has("cscope") && filereadable("/usr/bin/cscope")
 36    set csprg=/usr/bin/cscope
 37    set csto=0
 38    set cst
 39    set nocsverb
 40    " add any database in current directory
 41    if filereadable("cscope.out")
 42       cs add cscope.out
 43    " else add database pointed to by environment
 44    elseif $CSCOPE_DB != ""
 45       cs add $CSCOPE_DB
 46    endif
 47    set csverb
 48 endif
 49
 50 " Switch syntax highlighting on, when the terminal has colors
 51 " Also switch on highlighting the last used search pattern.
 52 if &t_Co > 2 || has("gui_running")
 53   syntax on
 54   set hlsearch
 55 endif

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.