vimrc.ja 2.3 KB

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