set nocompatible " Disable vi-compatibility set t_Co=256 colorscheme xoria256 set guifont=menlo\ for\ powerline:h16 set guioptions-=T " Removes top toolbar set guioptions-=r " Removes right hand scroll bar set go-=L " Removes left hand scroll bar set linespace=15 set showmode " always show what mode we're currently editing in set nowrap " don't wrap lines set tabstop=4 " a tab is four spaces set smarttab set tags=tags set softtabstop=4 " when hitting , pretend like a tab is removed, even if spaces set expandtab " expand tabs by default (overloadable per file type later) set shiftwidth=4 " number of spaces to use for autoindenting set shiftround " use multiple of shiftwidth when indenting with '<' and '>' set backspace=indent,eol,start " allow backspacing over everything in insert mode set autoindent " always set autoindenting on set copyindent " copy the previous indentation on autoindenting set number " always show line numbers set ignorecase " ignore case when searching set smartcase " ignore case if search pattern is all lowercase, set timeout timeoutlen=200 ttimeoutlen=100 set visualbell " don't beep set noerrorbells " don't beep set autowrite "Save on buffer switch set mouse=a " With a map leader it's possible to do extra key combinations " like w saves the current file let mapleader = "," let g:mapleader = "," " Fast saves nmap w :w! " Down is really the next line nnoremap j gj nnoremap k gk "Easy escaping to normal model imap jj "Auto change directory to match current file ,cd nnoremap ,cd :cd %:p:h:pwd "easier window navigation nmap h nmap j nmap k nmap l "Resize vsplit nmap :vertical resize +5 nmap 25 :vertical resize 40 nmap 50 = nmap 75 :vertical resize 120 nmap :NERDTreeToggle "Load the current buffer in Chrome nmap ,c :!open -a Google\ Chrome "Show (partial) command in the status line set showcmd " Create split below nmap :sp :rightbelow sp " Quickly go forward or backward to buffer nmap :bp :BufSurfBack nmap :bn :BufSurfForward highlight Search cterm=underline " Swap files out of the project root set backupdir=~/.vim/backup// set directory=~/.vim/swap// " Run PHPUnit tests map t :!phpunit % " Easy motion stuff let g:EasyMotion_leader_key = '' " Powerline (Fancy thingy at bottom stuff) let g:Powerline_symbols = 'fancy' set laststatus=2 " Always show the statusline set encoding=utf-8 " Necessary to show Unicode glyphs set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline) autocmd cursorhold * set nohlsearch autocmd cursormoved * set hlsearch " Remove search results command! H let @/="" " If you prefer the Omni-Completion tip window to close when a selection is " made, these lines close it on movement in insert mode or when leaving " insert mode autocmd CursorMovedI * if pumvisible() == 0|pclose|endif autocmd InsertLeave * if pumvisible() == 0|pclose|endif " Abbreviations abbrev pft PHPUnit_Framework_TestCase abbrev gm !php artisan generate:model abbrev gc !php artisan generate:controller abbrev gmig !php artisan generate:migration " Auto-remove trailing spaces autocmd BufWritePre *.php :%s/\s\+$//e " Edit todo list for project nmap ,todo :e todo.txt " Laravel framework commons nmap lr :e app/routes.php nmap lca :e app/config/app.php81Gf(%O nmap lcd :e app/config/database.php nmap lc :e composer.json " Concept - load underlying class for Laravel function! FacadeLookup() let facade = input('Facade Name: ') let classes = { \ 'Form': 'Html/FormBuilder.php', \ 'Html': 'Html/HtmlBuilder.php', \ 'File': 'Filesystem/Filesystem.php', \ 'Eloquent': 'Database/Eloquent/Model.php' \ } execute ":edit vendor/laravel/framework/src/Illuminate/" . classes[facade] endfunction nmap ,lf :call FacadeLookup() " CtrlP Stuff " Familiar commands for file/symbol browsing map :CtrlP map :CtrlPBufTag " I don't want to pull up these folders/files when calling CtrlP set wildignore+=*/vendor/** set wildignore+=*/public/forum/** " Open splits nmap vs :vsplit nmap sp :split " Create/edit file in the current directory nmap :ed :edit %:p:h/ " Prepare a new PHP class function! Class() let name = input('Class name? ') let namespace = input('Any Namespace? ') if strlen(namespace) exec 'normal i " Add a new dependency to a PHP class function! AddDependency() let dependency = input('Var Name: ') let namespace = input('Class Path: ') let segments = split(namespace, '\') let typehint = segments[-1] exec 'normal gg/construct^M:H^Mf)i, ' . typehint . ' $' . dependency . '^[/}^>O$this->^[a' . dependency . ' = $' . dependency . ';^[?{^MkOprotected $' . dependency . ';^M^[?{^MOuse ' . namespace . ';^M^[' " Remove opening comma if there is only one dependency exec 'normal :%s/(, /(/g ' endfunction nmap ,2 :call AddDependency()