home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim53os2.zip / vim-5.3 / vimrc_example < prev    next >
Text File  |  1998-08-30  |  2KB  |  68 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 bs=2        " allow backspacing over everything in insert mode
  11. set ai            " always set autoindenting on
  12. set backup        " keep a backup file
  13. set viminfo='20,\"50    " read/write a .viminfo file, don't store more
  14.             " than 50 lines of registers
  15.  
  16. " In text files, always limit the width of text to 78 characters
  17. autocmd BufRead *.txt set tw=78    
  18.  
  19. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  20. " let &guioptions = substitute(&guioptions, "t", "", "g")
  21.  
  22. " Don't use Ex mode, use Q for formatting
  23. map Q gq
  24.  
  25. " Switch syntax highlighting on, when the terminal has colors
  26. " Also switch on highlighting the last used search pattern.
  27. if &t_Co > 2 || has("gui_running")
  28.   syntax on
  29.   set hlsearch
  30. endif
  31.  
  32. augroup cprog
  33.   " Remove all cprog autocommands
  34.   au!
  35.  
  36.   " When starting to edit a file:
  37.   "   For *.c and *.h files set formatting of comments and set C-indenting on.
  38.   "   For other files switch it off.
  39.   "   Don't change the order, it's important that the line with * comes first.
  40.   autocmd BufRead *       set formatoptions=tcql nocindent comments&
  41.   autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
  42. augroup END
  43.  
  44. augroup gzip
  45.   " Remove all gzip autocommands
  46.   au!
  47.  
  48.   " Enable editing of gzipped files
  49.   "      read:    set binary mode before reading the file
  50.   "        uncompress text in buffer after reading
  51.   "     write:    compress file after writing
  52.   "    append:    uncompress file, append, compress file
  53.   autocmd BufReadPre,FileReadPre    *.gz set bin
  54.   autocmd BufReadPost,FileReadPost    *.gz let ch_save = &ch|set ch=2
  55.   autocmd BufReadPost,FileReadPost    *.gz '[,']!gunzip
  56.   autocmd BufReadPost,FileReadPost    *.gz set nobin
  57.   autocmd BufReadPost,FileReadPost    *.gz let &ch = ch_save|unlet ch_save
  58.   autocmd BufReadPost,FileReadPost    *.gz execute ":doautocmd BufReadPost " . expand("%:r")
  59.  
  60.   autocmd BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
  61.   autocmd BufWritePost,FileWritePost    *.gz !gzip <afile>:r
  62.  
  63.   autocmd FileAppendPre            *.gz !gunzip <afile>
  64.   autocmd FileAppendPre            *.gz !mv <afile>:r <afile>
  65.   autocmd FileAppendPost        *.gz !mv <afile> <afile>:r
  66.   autocmd FileAppendPost        *.gz !gzip <afile>:r
  67. augroup END
  68.