" No compatible. You want to use Vim, not vi set nocp " We don't wrap lines, they become a LONG horizontal one (useful) set nowrap " Set background to dark to have nicer syntax highlighting. "set background=dark " We keep 3 lines when scrolling set scrolloff=3 " We show vertical and horizontal position set ruler " Y = y$ not yy. More intuative noremap Y y$ " Tilde (~) acts like an operator (à la 'd' or 'c') "set top " Incremental search set is " Ignore case when searching set ic " Show matching ()'s []'s {}'s set sm " Tabs are 4 spaces long set tabstop=4 " When autoindent does a tab, it's 4 spaces long set shiftwidth=4 " No need to save to make a :next :previous, etc. set aw " No idea what it's for... set backspace=2 " No bell sound set errorbells " Put title in title bar set title " Smoother changes set ttyfast " Tabs are converted to space characters "set et " Remove autocommands just in case autocmd! "----- only turn on syntax highlighting of there are more than one color syntax on "----- don't don't out in insert mode set noinsertmode "----- show the command in the status line set showcmd "----- you need digraphs for uumlauts " set digraph set joinspaces " yes. allow magic patterns in searches set magic " we use bash set shell=bash "set autowrite set nobackup " dictionary: english words first set dictionary=/usr/dict/words " esckeys: allow usage of cursor keys within insert mode " You will find this useful when working, eg, on SunOS. set esckeys " formatoptions: Options for the "text format" command ("gq") " I need all those options (but 'o')! set formatoptions=cqr " hidden: Allow "hidden" buffers. A must-have! set hidden " " " hlsearch : highlight search - show the current search pattern " This is a nice feature sometimes - but it sure can get in the " way sometimes when you edit. set hlsearch " " modeline: ... " Allow the last line to be a modeline - useful when " the last line in sig gives the preferred textwidth for replies. set modeline set modelines=1 " " report: show a report when N lines were changed. " report=0 thus means "show all changes"! set report=0 " " runtimepath: list of dirs to search for runtime files " runtimepath is for Vim-6 only! if version>=600 set runtimepath+=~/.vim,~/.vim/after,/usr/share/vim/vim60 endif " " shiftwidth: Number of spaces to use for each " insertion of (auto)indent. " set shiftwidth=8 set shiftwidth=2 " " shortmess: Kind of messages to show. Abbreviate them all! " New since vim-5.0v: flag 'I' to suppress "intro message". set shortmess=at " " showcmd: Show current uncompleted command? Absolutely! set showcmd " " showmatch: Show the matching bracket for the last ')'? set showmatch " " showmode: Show the current mode? YEEEEEEEEESSSSSSSSSSS! set showmode " " startofline: no: do not jump to first character with page " commands, ie keep the cursor in the current column. set nostartofline " " splitbelow: Create new window below current one. set splitbelow " " ttyscroll: turn off scrolling -> faster! " set ttyscroll=0 " " whichwrap: " Allow jump commands for left/right motion to wrap to previous/next " line when cursor is on first/last character in the line: set whichwrap=<,>,h,l,[,] " " wildchar the char used for "expansion" on the command line " default value is "" but I prefer the tab key: set wildchar= " " wrapmargin: set wrapmargin=1 " " writebackup: set nowritebackup " " When I let Vim write the current buffer I frequently mistype the " command ":w" as ":W" - so I have to remap it to correct this typo: nmap :W :w " " Are you used to the Unix commands "alias" and "which"? " I sometimes use these to look up my abbreviations and mappings. " So I need them available on the command line: map :alias map map :which map " " The command {number}CTRL-G show the current nuffer number, too. " This is yet another feature that vi does not have. " As I always want to see the buffer number I map it to CTRL-G. " Pleae note that here we need to prevent a loop in the mapping by " using the comamnd "noremap"! noremap 2 " " Define "del" char to be the same backspace (saves a LOT of trouble!) " As the angle notation cannot be use with the LeftHandSide " with mappings you must type this in *literally*! " map 127 "cmap 127 " the same for Linux Debian which uses " imap [3~ " " go in help map \\ " Lang map set langmap=£ÊÃÕËÅÎÇÛÝÚÈ߯Ù×ÁÐÒÏÌÄÖÜÑÞÓÍÉÔØÂÀ³êãõëåHçûýúèÿæù÷áðòïìäöüñþóíéôøâà;`qwertyuiop[]asdfghjkl;'zxcvbnm,.~QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<> " =================================================================== " General Editing - link to program "screen" " =================================================================== " " ,Et = edit temporary file of "screen" program map ,Et :e ~/tmp/virus.swp " " =================================================================== " General Editing - link to program "screen" " =================================================================== " " ,Et = edit temporary file of "screen" program map ,Et :e /tmp/screen-exchange " " QUIT map :q imap :q cmap :q " MENU source $VIMRUNTIME/menu.vim set wildmenu set cpo-=< set wcm= map :emenu " Indents autocmd BufRead *.c set cin autocmd BufRead *.pl set cin " When using mutt or slrn, text width=72 au! BufNewFile mutt* let @"="X-Editor: Vim-1.4b for MS-DOS 6.22\n"|exe 'norm 1G}""P' au! FileType mail let @"="X-Editor: Vim-1.4b for MS-DOS 6.22\n"|exe 'norm 1G}""P' autocmd BufRead mutt*[0-9] set formatoptions=cqrt autocmd BufRead .followup,.article,.letter set formatoptions=cqrt autocmd BufRead mutt*[0-9] set tw=72 autocmd BufRead .followup,.article,.letter set tw=72 " Text files have a text width of 72 characters autocmd BufNewFile *.txt set tw=72 autocmd BufRead *.txt set tw=72 " LaTeX configuration is in ~/vim/vim.latex autocmd BufNewFile *.tex source ~/vim/latex.vimrc autocmd BufRead *.tex source ~/vim/latex.vimrc " Automatically chmod +x Shell and Perl scripts autocmd BufWritePost *.sh !chmod +x % autocmd BufWritePost *.pl !chmod +x % "----- set up the stuff for color highlighing in an xterm "if &term =~ "xterm" if has("terminfo") set t_Co=16 set t_Sf=[3%p1%dm set t_Sb=[4%p1%dm set t_vb= else set t_Co=16 set t_Sf=[3%dm set t_Sb=[4%dm set t_vb= endif "endif 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 BufReadPre,FileReadPre *.gz let ch_save = &ch|set ch=2 autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz let &ch = ch_save|unlet ch_save autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv :r autocmd BufWritePost,FileWritePost *.gz !gzip :r autocmd FileAppendPre *.gz !gunzip autocmd FileAppendPre *.gz !mv :r autocmd FileAppendPost *.gz !mv :r autocmd FileAppendPost *.gz !gzip :r augroup END augroup bzip2 " Remove all bzip2 autocommands au! " Enable editing of bzipped 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 *.bz2 set bin autocmd BufReadPre,FileReadPre *.bz2 let ch_save = &ch|set ch=2 autocmd BufReadPost,FileReadPost *.bz2 |'[,']!bunzip2 autocmd BufReadPost,FileReadPost *.bz2 let &ch = ch_save|unlet ch_save autocmd BufReadPost,FileReadPost *.bz2 execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.bz2 !mv :r autocmd BufWritePost,FileWritePost *.bz2 !bzip2 :r autocmd FileAppendPre *.bz2 !bunzip2 autocmd FileAppendPre *.bz2 !mv :r autocmd FileAppendPost *.bz2 !mv :r autocmd FileAppendPost *.bz2 !bzip2 -9 --repetitive-best :r augroup END augroup filetype au! au! BufRead,BufNewFile *.ip set filetype=php au! BufRead,BufNewFile *.ih set filetype=php au! BufRead,BufNewFile *.phtml set filetype=php augroup END "function InsertTabWrapper() " let col = col('.') - 1 " if !col || getline('.')[col - 1] !~ '\k' " return "\" " else " return "\" " endif "endfunction "inoremap =InsertTabWrapper() "map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '>trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" .synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" set et set sw=4 set smarttab if &t_Co > 1 syntax on endif