Unix .vimrc


      
      " Vickery's .vimrc file for Unix 
      
      set nocompatible      " Don't force vi compatibility
      behave xterm          " Alternative is "mswin"
      
      set mouse=a           " Enable mouse support
      set selectmode=mouse  " Use mouse to select text
      set ai                " Turn on autoindenting
      set aw                " Save file when compiling, etc.
      set bs=2              " Allow backspacing over everything in insert mode
      set guioptions=f      " For use with pine
      set tw=70             " Limit the width of text to 70
      set viminfo='20,\"50  " Read/write a .viminfo file, don't store more
                            " than 50 lines of registers
      set whichwrap=b,s,<,>,[,] " End of line cursor support
      set nobackup          " Do not create backup files
      set expandtab         " No tabs in the output file!
      set ruler
      set shiftwidth=2      " What you get for ^D
      set tabstop=2         " Same as shiftwidth
      set showmatch
      syntax on
      "set comments=sl:/**,mb:\ *,exl:\ */,sr:/*,mb:*,exl:*/,://
      
      " When starting to edit a file:
      "   For Java, C, and C++ files set formatting of comments and set 
      "   C-indenting on.   For other files switch it off.
      "   Don't change the sequence, it's important that the line with * comes first.
      autocmd BufRead * set formatoptions=tcql nocindent comments&
      autocmd BufRead *.java,*.c,*.h,*.cc set formatoptions=ctroq cindent comments=sr:/**,mb:*,elx:*/,sr:/*,mb:*,elx:*/,://
      
      " Format the current paragraph according to
      " the current 'textwidth' with CTRL-J:
        nmap <C-J>      gqap
        vmap <C-J>      gq
        imap <C-J>      <C-O>gqap
        
      " Beginning and end of line with CTRL-A and CTRL-E
        map  <C-A>      0
        map  <C-E>      $
        imap <C-A>      <C-O>0
        imap <C-E>      <C-O>$
      " Delete line with CTRL-K
        map  <C-K>      dd
        imap <C-K>      <C-O>dd
      " Switch buffers
        imap <C-^>      <C-O><C-^>
      " PgDn
        imap [6;5~    <C-O>:n<CR>
        map  [6;5~    :n<CR>
      " PgUp
        imap [5;5~    <C-O>:N<CR>
        map  [5;5~    :N<CR>
      " Write file
        map   <C-W>     :w<CR>
        imap  <C-W>     <C-O>:w<CR>
      " Suspend from insert mode
        imap  <C-Z>     <C-O><C-Z>