home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / vimrc < prev   
Encoding:
Text File  |  1999-08-10  |  2.5 KB  |  71 lines

  1. " Vim
  2. " An example for a vimrc file.
  3. "
  4. " To use it, copy it to
  5. "     for Unix and OS/2:  ~/.vimrc
  6. "             for Amiga:  s:.vimrc
  7. "  for MS-DOS and Win32:  $VIM\_vimrc
  8.  
  9. set nocompatible    " Use Vim defaults (much better!)
  10. set backspace=2        " allow backspacing over everything in insert mode
  11. set showmatch           " jump emacs style to matching bracket
  12. set incsearch           " highlight match while typing search pattern
  13.  
  14. " set ai        " always set autoindenting on
  15. " set backup        " keep a backup file
  16. " set viminfo='20,\"50    " read/write a .viminfo file, don't store more
  17.             " than 50 lines of registers
  18.  
  19. " In text files, always limit the width of text to 78 characters
  20. autocmd BufRead *.txt set tw=78    
  21.  
  22. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  23. " let &guioptions = substitute(&guioptions, "t", "", "g")
  24.  
  25. " Don't use Ex mode, use Q for formatting
  26. map Q gq
  27.  
  28. " Switch syntax highlighting on, when the terminal has colors
  29. " Also switch on highlighting the last used search pattern.
  30. if &t_Co > 2 || has("gui_running")
  31.   " syntax on
  32.   set hlsearch
  33. endif
  34.  
  35. augroup cprog
  36.   " Remove all cprog autocommands
  37.   au!
  38.  
  39.   " When starting to edit a file:
  40.   "   For *.c and *.h files set formatting of comments and set C-indenting on.
  41.   "   For other files switch it off.
  42.   "   Don't change the order, it's important that the line with * comes first.
  43.   autocmd BufRead *       set formatoptions=tcql nocindent comments&
  44.   autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
  45. augroup END
  46.  
  47. augroup gzip
  48.   " Remove all gzip autocommands
  49.   au!
  50.  
  51.   " Enable editing of gzipped files
  52.   "      read:    set binary mode before reading the file
  53.   "        uncompress text in buffer after reading
  54.   "     write:    compress file after writing
  55.   "    append:    uncompress file, append, compress file
  56.   autocmd BufReadPre,FileReadPre    *.gz set bin
  57.   autocmd BufReadPost,FileReadPost    *.gz let ch_save = &ch|set ch=2
  58.   autocmd BufReadPost,FileReadPost    *.gz '[,']!gunzip
  59.   autocmd BufReadPost,FileReadPost    *.gz set nobin
  60.   autocmd BufReadPost,FileReadPost    *.gz let &ch = ch_save|unlet ch_save
  61.   autocmd BufReadPost,FileReadPost    *.gz execute ":doautocmd BufReadPost " . expand("%:r")
  62.  
  63.   autocmd BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
  64.   autocmd BufWritePost,FileWritePost    *.gz !gzip <afile>:r
  65.  
  66.   autocmd FileAppendPre            *.gz !gunzip <afile>
  67.   autocmd FileAppendPre            *.gz !mv <afile>:r <afile>
  68.   autocmd FileAppendPost        *.gz !mv <afile> <afile>:r
  69.   autocmd FileAppendPost        *.gz !gzip <afile>:r
  70. augroup END
  71.