wesdeboer /.vimrc

"""""""""""""""""""""""""""""""""""""""""""""""""""
" TABBING 
"""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent " auto indent - automatically indent to same as previous line
set smartindent " smart indent - add additional indent after { etc...
set smarttab " smart tab - use tabs at beginning of line, spaces elsewhere
set expandtab " expand tabs to spaces
set shiftwidth=4 " set tabs to 4 space width
set tabstop=4 " set tabs to 4 space width

"""""""""""""""""""""""""""""""""""""""""""""""""""
" DISPLAY
"""""""""""""""""""""""""""""""""""""""""""""""""""
set number " number the lines
set showmode " shows whether in insert, visual etc...
set showmatch " show matching braces
set ffs=dos,unix,mac " support these filetypes
syntax on " syntax higlighting
set background=dark " set the base color
colorscheme desert " set the colors


set history=50 " number of commands to save in the history
set wildmenu " wildmenu allows for displaying the tab completion possibilities
set cmdheight=2 " set the command bar height
set report=0 " shows how many lines were changed after running a command
set nocompatible " don't use vi's compatible mode
set shell=bash " set shell
set ruler " show where you are in the file
set laststatus=2 " show the statusline

set statusline=File:\ %F%m%r%h\ %w\ \ Dir:\ %r%{CurDir()}%h\ %c,%l
set foldmethod=marker
set foldopen=all
set foldclose=all
set hlsearch " highlight all search terms
set incsearch " auto increment search
set ignorecase " ignore case when searching
set backspace=start,eol,indent " use backspace more effectively
set noerrorbells " turn off the sounds
set grepprg=grep\ -nH\ $*
filetype plugin on " filetype detection
filetype indent on " filetype indentation
" remove \r carriage returns with ctrl m
map   :silent %s/\r//g
nmap   :silent noh " turn off search highlighting with ctrl n
set viminfo='10,\"100,:20,%,n~/.viminfo 
vmap sb "zdiz 

function! CHANGE_CURR_DIR()
	let _dir = expand("%:p:h")
	exec "cd " . _dir
	unlet _dir
endfunction

autocmd BufEnter * call CHANGE_CURR_DIR()

map  j_
map  k_
inoremap  :call PhpDocSingle()i
nnoremap  :call PhpDocSingle()
vnoremap  :call PhpDocRange()
" {{{ Automatic close char mapping

" More common in PEAR coding standard
" inoremap  { {}O
" Maybe this way in other coding standards
inoremap  { {}O
inoremap ( ()
inoremap [ []
" Standard mapping after PEAR coding standard
inoremap " ""
inoremap ' ''

" }}} Automatic close char mapping

" {{{ Wrap visual selections with chars

:vnoremap ( "zdi(z)
:vnoremap { "zdi{z}
:vnoremap [ "zdi[z]
:vnoremap ' "zdi'z'
:vnoremap " "zdi"z"

" }}} Wrap visual selections with chars

" {{{ Dictionary completion

" The completion dictionary is provided by Rasmus:
" http://lerdorf.com/funclist.txt
set dictionary-=/home/wes/.vim/funclist.txt dictionary+=/home/wes/.vim/funclist.txt
" Use the dictionary completion
set complete-=k complete+=k

" }}} Dictionary completion

" {{{ Autocompletion using the TAB key

" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
func! InsertTabWrapper()
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
        return "\"
    else
        return "\"
    endif
endfunction

" Remap the tab key to select action with InsertTabWrapper
inoremap  =InsertTabWrapper()

" }}} Autocompletion using the TAB key
"
let php_sql_query=1
let php_htmlInStrings=1
let php_noShortTags=1
let php_folding=1

set tags=~/.vim/tags/eats

function! CurDir()
	let curdir = substitute(getcwd(), '/home/wes/', '~/', 'g')
	return curdir
endfunction

autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul 

source ~/.vim/php-doc.vim