home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim54rt.sit / runtime / vimrc_example.vim < prev   
Encoding:
Text File  |  1999-08-14  |  2.7 KB  |  79 lines  |  [TEXT/ALFA]

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