set nocompatible " Use Vim defaults (much better!) filetype on " detect the type of file set bs=2 " allow backspacing over everything in insert mode set history=500 " keep 50 lines of command line history set ruler " show the cursor position all the time set tabstop=4 " set the tab stop, duh! set shiftwidth=4 " so C autoindent works right. set number " turns on line numbers " Visual instead of literal cursor motion nnoremap j gj nnoremap k gk nnoremap gj nnoremap gk nnoremap gja nnoremap gka inoremap gja inoremap gka " toggle line numbers on and off nmap :set invnumber " set e to emulate the end key nmap e $ " set b to emulate the home key nmap b 0 " support all 3 file formats set ffs=unix,dos,mac " echo the output of phpm on :Php command -nargs=+ Php :echom system("phpm ") " Only do this part when compiled with support for autocommands if has("autocmd") " When editing a file, always jump to the last cursor position autocmd BufReadPost * if line("'\"") | exe "'\"" | endif endif " Don't use Ex mode, use Q for formatting map Q gq " When the terminal has colors if &t_Co > 2 || has("gui_running") syntax on " switch syntax hilighting on set nohlsearch " don't hilight search results set incsearch " ... except when im typing set showmatch " show matching brackets... set mat=1 " ...for 5 tenths of a second endif if has("autocmd") autocmd BufEnter * syntax sync fromstart " make sure files get hilighted. autocmd BufRead /tmp/* set nobackup nowritebackup autocmd FileType * set formatoptions=tcql cindent comments& "autocmd FileType c,cpp,php set formatoptions=croql cindent comments& autocmd Filetype css set formatoptions=tcql nocindent noai 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 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 endif if &term=="xterm" set t_Co=8 set t_Sb=^[4%dm set t_Sf=^[3%dm endif " A couple of useful abbreviations iab xhtmlhead kko iab phpi 2hi iab phpn ?>kko iab htstr 8hi