[ILUG] Perl & vi

Justin Mason jm at jmason.org
Fri Nov 26 15:37:30 GMT 1999


Brian Nesbitt said:

>   Has anyone got a .exrc file that colours perl in vim? If so
>   could you mail me a copy.

Sure -- here's mine.  This needs to be called .vimrc BTW AFAIK. Make
sure it includes "syntax on" 'cos that's the line that does the magic!

--j.


  version 5.0
  "
  set autoindent
  set vb
  "
  set mouse=h
  "
  "     vi-style, only one level of undo/redo
  set   undolevels=0
  "
  set sw=2 report=1 ai ap noic nomesg noslowopen noterse nonu optimize beautify
  set bs=2 showcmd ttyfast nottybuiltin
  ""
  " :set t_me=          " normal mode (undoes t_mr and t_md)
  " :set t_mr=  " reverse (invert) mode
  " :set t_md=    " bold mode
  " :set t_se=    	 " standout end
  " :set t_so=    " standout mode
  " :set t_ue=     	 " underline end
  " :set t_us=       " underline mode start
  "
  :set t_me=
  :set t_mr=
  :set t_md=
  :set t_se=
  :set t_so=
  :set t_ue=
  :set t_us=
  :set t_ZR=
  :set t_ZH=
  ""
  augroup cprog
    " Remove all cprog autocommands
    au!

    " When starting to edit a file:
    "   For *.c and *.h files set formatting of comments and set C-indenting on.
    "   For other files switch it off.
    "   Don't change the order, it's important that the line with * comes first.
    autocmd BufRead *       set formatoptions=tclq nocindent comments&
    autocmd BufRead *.c,*.h set formatoptions=croq2 textwidth=70 cindent comments=sr:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
  augroup END

  augroup gzip
    " Remove all gzip autocommands
    au!

    " Enable editing of gzipped files
    "       read: set binary mode before reading the file
    "             uncompress text in buffer after reading
    "      write: compress file after writing
    "     append: uncompress file, append, compress file
    autocmd BufReadPre,FileReadPre        *.gz set bin
    autocmd BufReadPost,FileReadPost      *.gz '[,']!gunzip
    autocmd BufReadPost,FileReadPost      *.gz set nobin
    autocmd BufReadPost,FileReadPost      *.gz execute ":doautocmd BufReadPost " . %:r

    autocmd BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
    autocmd BufWritePost,FileWritePost    *.gz !gzip <afile>:r

    autocmd FileAppendPre                 *.gz !gunzip <afile>
    autocmd FileAppendPre                 *.gz !mv <afile>:r <afile>
    autocmd FileAppendPost                *.gz !mv <afile> <afile>:r
    autocmd FileAppendPost                *.gz !gzip <afile>:r
  augroup END

  set background=dark
  syntax on
  source $VIM/syntax/syntax.vim

    hi Normal	guifg=Yellow guibg=MidnightBlue
    hi Comment	ctermfg=1 guifg=OrangeRed1 term=NONE guibg=MidnightBlue
    hi Constant	ctermfg=4 guifg=LightBlue1 term=NONE guibg=MidnightBlue
    hi Identifier	ctermfg=6 guifg=LightCyan term=NONE guibg=MidnightBlue
    hi Statement	ctermfg=3 guifg=LightYellow1 term=NONE guibg=MidnightBlue
    hi PreProc	ctermfg=4 guifg=LightBlue1 term=NONE guibg=MidnightBlue
    hi Type	ctermfg=2 guifg=SeaGreen1 term=NONE guibg=MidnightBlue
    hi Special	ctermfg=7 guifg=white term=NONE guibg=MidnightBlue
    hi Search	term=standout ctermbg=DarkRed cterm=bold guibg=DarkRed

    au BufNewFile,BufReadPost */Mail/drafts/* so $VIM/syntax/mail.vim
    au BufNewFile,BufReadPost */Mail/drafts/* set tw=74





More information about the ILUG mailing list