| 1 | " Vimrc file |
|---|
| 2 | " |
|---|
| 3 | set nocompatible " Use Vim defaults (much better!) |
|---|
| 4 | set bs=indent,eol,start " allow backspacing over everything in insert mode |
|---|
| 5 | "set ai " always set autoindenting on |
|---|
| 6 | "set backup " keep a backup file |
|---|
| 7 | set viminfo='20,\"50 " read/write a .viminfo file, don't store more |
|---|
| 8 | " than 50 lines of registers |
|---|
| 9 | set history=50 " keep 50 lines of command line history |
|---|
| 10 | set ruler " show the cursor position all the time |
|---|
| 11 | |
|---|
| 12 | set ambiwidth=double " CJK ambigious width |
|---|
| 13 | |
|---|
| 14 | " Only do this part when compiled with support for autocommands |
|---|
| 15 | if has("autocmd") |
|---|
| 16 | augroup vine |
|---|
| 17 | autocmd! |
|---|
| 18 | " In text files, always limit the width of text to 78 characters |
|---|
| 19 | autocmd BufRead *.txt set tw=78 |
|---|
| 20 | " When editing a file, always jump to the last cursor position |
|---|
| 21 | autocmd BufReadPost * |
|---|
| 22 | \ if line("'\"") > 0 && line ("'\"") <= line("$") | |
|---|
| 23 | \ exe "normal! g'\"" | |
|---|
| 24 | \ endif |
|---|
| 25 | " don't write swapfile on most commonly used directories for NFS mounts or USB sticks |
|---|
| 26 | autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp |
|---|
| 27 | " start with spec file template |
|---|
| 28 | autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec |
|---|
| 29 | augroup END |
|---|
| 30 | endif |
|---|
| 31 | |
|---|
| 32 | if has("cscope") && filereadable("/usr/bin/cscope") |
|---|
| 33 | set csprg=/usr/bin/cscope |
|---|
| 34 | set csto=0 |
|---|
| 35 | set cst |
|---|
| 36 | set nocsverb |
|---|
| 37 | " add any database in current directory |
|---|
| 38 | if filereadable("cscope.out") |
|---|
| 39 | cs add cscope.out |
|---|
| 40 | " else add database pointed to by environment |
|---|
| 41 | elseif $CSCOPE_DB != "" |
|---|
| 42 | cs add $CSCOPE_DB |
|---|
| 43 | endif |
|---|
| 44 | set csverb |
|---|
| 45 | endif |
|---|
| 46 | |
|---|
| 47 | " Switch syntax highlighting on, when the terminal has colors |
|---|
| 48 | " Also switch on highlighting the last used search pattern. |
|---|
| 49 | if &t_Co > 2 || has("gui_running") |
|---|
| 50 | syntax on |
|---|
| 51 | set hlsearch |
|---|
| 52 | endif |
|---|
| 53 | |
|---|
| 54 | filetype plugin on |
|---|
| 55 | |
|---|
| 56 | if &term=="xterm" |
|---|
| 57 | set t_Co=8 |
|---|
| 58 | set t_Sb=[4%dm |
|---|
| 59 | set t_Sf=[3%dm |
|---|
| 60 | endif |
|---|
| 61 | |
|---|
| 62 | if $LANG =~ "ja.*" |
|---|
| 63 | if has("multi_byte") |
|---|
| 64 | set encoding=japan |
|---|
| 65 | set termencoding=japan |
|---|
| 66 | set fileencodings=iso-2022-jp,utf-8,utf-16,ucs-2-internal,ucs-2,shift-jis,euc-jp,japan |
|---|
| 67 | endif |
|---|
| 68 | endif |
|---|
| 69 | |
|---|
| 70 | if $LANG =~ "ja.*UTF-8" || $LANG =~ "ja.*utf8" |
|---|
| 71 | if has("multi_byte") |
|---|
| 72 | set encoding=utf-8 |
|---|
| 73 | set termencoding=utf-8 |
|---|
| 74 | set fileencodings=iso-2022-jp,shift-jis,euc-jp,utf-8,utf-16,ucs-2-internal,ucs-2,japan |
|---|
| 75 | endif |
|---|
| 76 | endif |
|---|
| 77 | |
|---|
| 78 | " Don't wake up system with blinking cursor: |
|---|
| 79 | " http://www.linuxpowertop.org/known.php |
|---|
| 80 | let &guicursor = &guicursor . ",a:blinkon0" |
|---|