"USEFUL COMMANDS (NO CONFIG NEEDED):
" :sp (filename) - loads filename in new split window. if no filename is
" specified, the current file is loaded
" Split window manipulation:
" <CTL-W>+
" k - move up one split
" j - move down one split
" + - make this window bigger
" - - make this window smaller
" :(w)q - (write and) close this split
" :TOhtml - creates HTML file from current file using syntax coloring
"
" HOW TO USE THE HELP FILES
" The help files are a great resource, but they're a bit confusing to learn
" For help on a topic, type :help
" Links look like |this| - if you cursor over them and type <CTL+]>, you'll
" jump to that section of help. To get back to where you were, type <CTL+0>
syntax on
colorscheme murphy
set nocompatible " Use Vim defaults (much better!)
set bs=2 " Allow backspacing over everything in insert mode
set ai " Always set auto-indenting on
"set backup " Keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file -- limit to only 50
set history=50 " keep 50 lines of command history
set ruler " Show the cursor position all the time
set ts=4 " 4 space wide tabs
set sw=4
set softtabstop=4 "makes backspacing over spaced out tabs work real nice
set expandtab "expand tabs to spaces
set ignorecase
set background=dark "awesome for terminals with crappy colors (putty!)
set tagstack "lets you push and pop your jumps with ctrl+]
set pastetoggle=<F11> "when you're pasting stuff this keeps it from getting
"all whacked out with indentation
set foldmethod=manual "enable code folding
"javac in vim
"set makeprg=javac\ %
"set errorformat=%A%f:%l\ %m,%-Z%p^,%-C%.%#
"gcc in vim
set makeprg=gcc\ -o\ %<\ %
"dictionary word autocomplete. type <CTL-N> in the middle of a word to use
set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words
set complete-=k complete+=k
"fix broke-ass sun terminals (if we're stuck on one)
set t_cl=^[[2J
" Don't use Ex mode, use Q for formatting
map Q gq
"collapsing window splits
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
" remove ^M characters from windows files
map <C-M> mvggVG:s/<C-V><CR>//g<CR>`v
"cstags mapping
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
"rot13 dmca-grade encryption
"this is useful to obfuscate whatever it is that you're working on temporarily
"if someone walks by (vim pr0n?)
map <F3> mzggVGg?`z
"space bar folding
nnoremap <silent> <space> :exe 'silent! normal! za'.(foldlevel('.')?'':'l')<cr>
"don't expand tabs if we're in a makefile
au BufRead,BufNewFile Makefile set ts=4 sw=4 noexpandtab
autocmd BufNewFile,BufRead *.txt set tw=78
autocmd BufNewFile,BufRead *.tex set tw=80
"good tab completion - press <tab> to autocomplete if there's a character
"previously
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
if has("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
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
endif
"latexSuite plugin
filetype plugin on
set grepprg=grep\ -nH\