" vim:et:sw=2:ts=2 " Use Vim settings, rather than Vi settings, must be the first option " for its side effects. set nocompatible " check for Byte-Order-Mark, then utf8, and finally assume latin1 set fileencodings=ucs-bom,utf-8,latin1 " force encoding when reading/writing with: " :e|w ++enc=encoding file " allow backspacing over everything in insert mode set backspace=indent,eol,start set nobackup " do not keep a backup file set backupcopy=auto,breakhardlink " break hardlinks on write set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set smartcase " ignore case when searching if search pattern contains lowercase " letters only set incsearch " do incremental searching set nohlsearch " don't highlight search matches set showmatch " jump to matching bracket when inserting one set wildmenu " tab completion shows options above command line " "disabled: let filetype define it "set smartindent " do smart autoindenting when starting a new line syntax on " switch syntax highlighting on " Q, by default, switches to Ex mode; make it reformat the current paragraph " instead (more useful) map Q gqap " Map F1 to the ESC key in insert mode, and Help otherwise " together) imap [11~ map [11~ :h " F7 macro for toggling between syntax on and off map :if exists("syntax_on") \ syntax off \ else \ syntax enable \ endif " make grep also work well with a single file set grepprg=grep\ -nH\ $* " syntax highlighting inside C comment strings let c_comment_strings=1 " assume sh is bash let g:is_bash=1 " for zenburn, assume running in a bright environment "let g:zenburn_high_Contrast = 1 " In many terminal emulators the mouse works just fine, thus enable it. " conflicts with c&p, disabled "set mouse=a " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis " use cscope if available if has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " prevent duplication of autocommands if !exists("autocommands_loaded") let autocommands_loaded = 1 " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif " indent style used by subversion authors au BufNewFile,BufRead ~/work/subversion/**/*.[ch] \ setlocal cinoptions={.5s,:.5s,+.5s,t0,g0,^-2,e-2,n-2,p2s,(0,=.5s \ formatoptions=croql cindent shiftwidth=4 tabstop=8 au BufNewFile,BufRead *.comp \ setlocal shiftwidth=4 tabstop=4 expandtab filetype=mason au BufNewFile,BufRead /**/apps/**/*.html \ setlocal shiftwidth=4 tabstop=4 expandtab filetype=mason " indent style and file type for tests au BufNewFile,BufRead *.t \ setlocal shiftwidth=4 tabstop=4 expandtab filetype=perl " indent style and file type for perl modules au BufNewFile,BufRead *.pm \ setlocal shiftwidth=4 tabstop=4 expandtab filetype=perl " indent style and file type for perl scripts au BufNewFile,BufRead *.pl \ setlocal shiftwidth=4 tabstop=4 expandtab filetype=perl " use git styles for git commit message au BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit " options for when composing mail in mutt au BufNewFile,BufRead /tmp/mutt* \ setlocal shiftwidth=4 tabstop=4 expandtab spell filetype=mail " load personal commands for all files au BufEnter * runtime! my/*.vim endif else " no autocmd set autoindent "always set autoindenting on endif " autocmd