" Remove ALL auto-commands. This avoids having the autocommands twice when " the vimrc file is sourced again. autocmd! set backspace=indent,start,eol set exrc set autoindent set noautowrite set nobackup set writebackup set sidescroll=1 set shiftwidth=2 set updatecount=0 set taglength=0 set tags+=../tags,/usr/local/include/tags,/usr/include/tags set wrapscan set shell=$SHELL\ -f set ruler set report=1 set expandtab set tabstop=4 set noicon set mouse=ar set noshowmode set wildmode=longest,list,full set showmatch set helpheight=100 set guioptions=ail set guicursor=a:block-blinkoff0 set hlsearch set nostartofline set background=dark set highlight=l:MySearch set clipboard=autoselect set visualbell t_vb= set viminfo= if &fileformat == "dos" set backupdir=C:/Program\ Files/vim/tmp set guifont=vt100:h8 set lines=85 set columns=109 else set backupdir=/tmp set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1 endif let c_syntax_for_h=1 let perl_fold=1 if &fileformat == "dos" || &term =~ "xterm" || &term =~ "vt220" set title endif if &term == "xterm" || &term == "vt220" " Automatically restores the xterm screen even if it wasn't compiled in. set t_ti=7[?47h set t_te=[?47l8 " Let the title stuff work even if we don't open the DISPLAY set t_ts=]2; set t_fs= endif autocmd BufEnter * let &titlestring = $HOSTNAME . ":" . expand("%:p:~") " Make the function keys work from home if &term == "vt220" set t_k1=[11~ set t_k2=[12~ set t_k3=[13~ set t_k4=[14~ set t_k5=[15~ endif " turn search highlighting on and off map :set hls!set hls? imap :set hls!set hls?i map :r !date imap :r !datei map M :set paste!set paste? map F :set formatoptions=tcqlset tw=72 map s :source $HOME/.vimrc map  $ map  :bn " map Ctrl-A, Ctrl-E, and Ctrl-K in *all* modes. map! makes the mapping work in " insert and commandline modes too. map map map J map! map! imap Ji " I'm used to Q formatting text. Newer versions of Vim changed this, so I " change it back map Q gq " Turn off incremental searching for files over 10,000,000 bytes. It's too slow. function! IncSearch() if line2byte(line("$")) < 10000000 set incsearch else set noincsearch endif endfunction autocmd BufReadPost * call IncSearch() autocmd BufEnter * doautocmd FileType if &filetype == "" setfiletype text endif function! PoundComment() map - 0i# j map _ :s/^\s*# \=//gj set comments=:# endfunction function! LispComment() map - 0i; j map _ :s/^\s*; \=//gj set comments=:; endfunction function! HTMLComment() map - $a -->0i[ \t]*$//gj set tw=0 formatoptions=tcq endfunction function! CComment() map - $a */0i/* map _ :s/^\s*\/\* \=//g:s/ \=\*\/[ \t]*$//gj set nocindent comments=sr:/*,mb:*,ex:*/,:// " set nocindent comments=:/*,:// endfunction function! TexComment() map - 0i% j map _ :s/^\s*% \=//gj set nocindent comments=sr:%,mb:%,el:%,:// set tw=72 formatoptions=tcqro endfunction function! CPlusPlusComment() map - 0i// j map _ :s/^\s*\/\/ \=//gj set nocindent comments=:\/\/ endfunction function! VHDLComment() map - 0i-- j map _ :s/^\s*-- \=//gj set comments=:-- endfunction " function! CDSLibComment() " map - 0i-- j " map _ :s/^\s*-- \=//gj " set nocindent comments=:-- " endfunction function! SpiceComment() map - 0i* j map _ :s/^\s*\* \=//gj set comments=:* endfunction function! ConfigComment() map - 0idnl j map _ :s/^\s*dnl \=//gj set comments=:dnl endfunction function! VimComment() map - 0i" j map _ :s/^\s*" \=//gj set comments=:\" endfunction function! XDefaultsComment() map - 0i! j map _ :s/^\s*! \=//gj set comments=:\! endfunction function! PostscriptComment() map - 0i%% j map _ :s/^\s*%%\= \=//gj set comments=:\! endfunction function! FT_text() call PoundComment() set tw=72 formatoptions=tcq endfunction autocmd Filetype html call HTMLComment() autocmd Filetype vhdl call VHDLComment() autocmd Filetype c call CComment() autocmd Filetype synopsys call CComment() autocmd Filetype tex call TexComment() autocmd Filetype cpp call CPlusPlusComment() autocmd Filetype java call CPlusPlusComment() autocmd Filetype verilog call CPlusPlusComment() autocmd Filetype xdefaults call XDefaultsComment() autocmd Filetype config call ConfigComment() autocmd Filetype vim call VimComment() autocmd Filetype lisp call LispComment() autocmd Filetype skill call LispComment() autocmd Filetype dosini call LispComment() autocmd Filetype spice call SpiceComment() autocmd Filetype perl call PoundComment() autocmd Filetype apache call PoundComment() autocmd Filetype csh call PoundComment() autocmd Filetype sh call PoundComment() autocmd Filetype cdslib call PoundComment() autocmd Filetype tcl call PoundComment() autocmd Filetype xs call PoundComment() autocmd Filetype make call PoundComment() autocmd Filetype conf call PoundComment() autocmd Filetype fvwm call PoundComment() autocmd Filetype samba call PoundComment() autocmd Filetype postscr call PostscriptComment() autocmd Filetype text call FT_text() " Use the colors by number from 0 to 15. I care about the cterm variables only. " I set the colors that I want in the .Xdefaults file. The first 8 colors have " been set to be the same as 8-color ANSI so that other apps (besides VIM!) can " have those colors set correctly. " " xterm*color0: black 0 0 0 " xterm*color1: red 255 0 0 " xterm*color2: green 0 255 0 " xterm*color3: yellow 255 255 0 " xterm*color4: blue 0 0 255 " xterm*color5: magenta 255 0 255 " xterm*color6: cyan 0 255 255 " xterm*color7: white 255 255 255 " xterm*color8: burlywood1 255 211 155 (ffd39b) " xterm*color9: sienna1 255 130 71 (ff8247) " xterm*color10: PaleVioletRed1 255 130 171 (ff82a0) " xterm*color11: LightSkyBlue 135 206 250 (87cefa) " xterm*color12: white " xterm*color13: white " xterm*color14: white " xterm*color15: white " highlighting for the GUI mode highlight Normal guifg=#e5e5e5 guibg=#000000 highlight Comment guifg=#ffd39b highlight Keyword guifg=#ffffff gui=bold highlight Statement guifg=#ffffff highlight String guifg=#87cefa highlight PreProc guifg=#ff8247 highlight Define guifg=#ff8247 highlight Include guifg=#ff8247 highlight Defined guifg=#ffff00 highlight Function guifg=#ffff00 gui=bold highlight Type guifg=#ff82a0 highlight StorageClass guifg=#ff82a0 highlight MySearch guibg=#0000ff highlight Constant guifg=#ffffff highlight Special guifg=#87cefa highlight Identifier guifg=#ffffff if &term =~ "xterm" || &term =~ "vt220" set t_Co=16 if has("terminfo") set t_AB=[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm set t_AF=[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm else set t_Sf=[3%dm set t_Sb=[4%dm endif highlight Comment ctermfg=8 highlight SpecialComment ctermfg=8 highlight Constant ctermfg=12 highlight String ctermfg=11 highlight Character ctermfg=11 highlight Function ctermfg=3 cterm=bold highlight Identifier ctermfg=12 highlight Statement ctermfg=7 highlight Conditional ctermfg=7 highlight Repeat ctermfg=7 highlight Label ctermfg=7 highlight Operator ctermfg=7 highlight Keyword ctermfg=13 cterm=bold highlight Exception ctermfg=7 highlight PreProc ctermfg=9 highlight Include ctermfg=9 highlight Define ctermfg=9 highlight Macro ctermfg=9 highlight PreCondit ctermfg=9 highlight Defined ctermfg=3 highlight Type ctermfg=10 highlight StorageClass ctermfg=10 highlight Special ctermfg=11 highlight Error ctermfg=1 ctermbg=3 highlight MySearch ctermbg=4 else " set the colors when not on a 16 color xterm. In this case, " only the ANSI colors 0-7 are available. set t_Co=8 if has("terminfo") set t_Sf=[3%p1%dm set t_Sb=[4%p1%dm else set t_Sf=[3%dm set t_Sb=[4%dm endif highlight Comment ctermfg=0 cterm=bold highlight SpecialComment ctermfg=0 cterm=bold highlight Constant ctermfg=4 cterm=bold highlight String ctermfg=3 cterm=bold highlight Character ctermfg=3 cterm=bold highlight Function ctermfg=3 highlight Identifier ctermfg=3 cterm=bold highlight Statement ctermfg=7 highlight Conditional ctermfg=7 highlight Repeat ctermfg=7 highlight Label ctermfg=7 highlight Operator ctermfg=7 highlight Keyword ctermfg=7 cterm=bold highlight Exception ctermfg=7 highlight PreProc ctermfg=1 cterm=bold highlight Include ctermfg=1 cterm=bold highlight Define ctermfg=1 cterm=bold highlight Macro ctermfg=1 cterm=bold highlight PreCondit ctermfg=1 cterm=bold highlight Defined ctermfg=3 highlight Type ctermfg=2 cterm=bold highlight StorageClass ctermfg=2 cterm=bold highlight Special ctermfg=3 cterm=bold highlight Error ctermfg=1 ctermbg=3 highlight MySearch ctermbg=4 endif syntax enable