if &shell =~# 'fish$' set shell=bash endif set nocompatible set runtimepath+=~/.vim/bundle/neobundle.vim/ filetype off call neobundle#begin(expand('~/.vim/bundle/')) " Utilities NeoBundleFetch 'Shougo/neobundle.vim' NeoBundle 'tpope/vim-dispatch' NeoBundle 'Shougo/vimproc.vim' NeoBundle 'Shougo/neocomplete' NeoBundle 'Shougo/neosnippet' NeoBundle 'Shougo/neosnippet-snippets' NeoBundle 'scrooloose/nerdtree' NeoBundle 'scrooloose/syntastic' NeoBundle 'mhinz/vim-startify' NeoBundle 'junegunn/vim-easy-align' NeoBundle 'kien/ctrlp.vim' NeoBundle 'sgur/ctrlp-extensions.vim' NeoBundle 'Lokaltog/vim-easymotion' NeoBundle 'jrhorn424/vim-multiple-cursors' NeoBundle 'rking/ag.vim' NeoBundle 'sjl/gundo.vim' NeoBundle 'tpope/vim-fugitive' " Enhancements NeoBundle 'tpope/vim-surround' NeoBundle 'tpope/vim-repeat' NeoBundle 'tpope/vim-commentary' NeoBundle 'tpope/vim-eunuch' NeoBundle 'dhruvasagar/vim-vinegar' NeoBundle 'terryma/vim-smooth-scroll' NeoBundle 'Raimondi/delimitMate' NeoBundle 'bling/vim-airline' NeoBundle 'bkad/CamelCaseMotion' NeoBundle 'vim-scripts/Parameter-Text-Objects' NeoBundle 'osyo-manga/vim-over' NeoBundle 'tmhedberg/matchit' NeoBundle 'matze/vim-move' NeoBundle 'xolox/vim-misc' NeoBundle 'xolox/vim-colorscheme-switcher' NeoBundle 'haya14busa/incsearch.vim' NeoBundle 'rhysd/clever-f.vim' NeoBundle 'christoomey/vim-tmux-navigator' " Language NeoBundle 'Rip-Rip/clang_complete' NeoBundle 'dag/vim-fish' NeoBundle 'marijnh/tern_for_vim' NeoBundle 'jelera/vim-javascript-syntax' NeoBundle 'hail2u/vim-css3-syntax' NeoBundle 'groenewege/vim-less' NeoBundle 'othree/javascript-libraries-syntax.vim' NeoBundle 'OmniSharp/omnisharp-vim' NeoBundle 'xolox/vim-lua-ftplugin' NeoBundle 'tclem/vim-arduino' " NeoBundle 'jplaut/vim-arduino-ino/' " Web NeoBundle 'mattn/emmet-vim' NeoBundle 'ap/vim-css-color' NeoBundle 'KabbAmine/vCoolor.vim' NeoBundle 'Valloric/MatchTagAlways' NeoBundle 'vim-scripts/closetag.vim' NeoBundle 'jaxbot/browserlink.vim' call neobundle#end() filetype plugin indent on set history=2000 set ruler set laststatus=2 set formatoptions=t set relativenumber set noshowmatch set splitbelow set splitright set hidden set wildmenu set wildmode=longest,full set backspace=eol,start,indent set novisualbell set noerrorbells let loaded_matchparen=0 set clipboard=unnamed set tabstop=4 set shiftwidth=4 set expandtab set sessionoptions-= set sessionoptions-=buffers set sessionoptions-=blank set guioptions-=r set guioptions-=L set guioptions-=e set mouse=a set foldmethod=syntax set foldcolumn=1 set nrformats+=alpha set nowrap let mapleader = "\" " Macros " To List noremap mtl f[xxbi<ea>bbiListb " To Array noremap mta f>Bdiwxf>xi[]B " Replace Word nnoremap rw :%s/\<\>/ " Clean up Interface nnoremap mi ddJO4jdd2kcc " Extract Definition nnoremap med "vyiwmv^/\u:nohlsearchy`v"ty`vov = new t();^v$hdV"ldk`v " Delete Outer Function nnoremap mdaf viBdVkpmtgv<}dd`t " Delete Surrounding Function vnoremap mdif "tdxXvBdt " Add Constructor nnoremap mac "tyiwjopublic t() {}iO// " Create Yield from IEnumerator nnoremap mye "tyiwmtowhile (t.MoveNext()) yield return t.Current;`t " Create Yield from Task nnoremap myt "tyiwmtowhile (!t.IsCompleted) yield return null;`t " Add Curly Braces to inline if nnoremap mif ^f(%ls {lio}kw " Surround with if statement vnoremap mif dOif () {}ikVp=iBk^f(a " Add ContextMenu to Function nnoremap mcm ^f(hyiwO[ContextMenu(""")]j^f(b " Add this.varName = varName; nnoremap mthis mmyiwothis.* = *;`m " Extra Line " alt + o noremap noremap / :nohlsearch nnoremap D d$ nnoremap Y y$ nnoremap vv ^v$h noremap \ q nnoremap vim :tabe $MYVIMRC noremap sr :w:so % nnoremap ' ` nnoremap ` ' noremap $ g_ nnoremap :w noremap = mt=i}`t " Buffers nnoremap q :bw nnoremap bb :b# nnoremap bd :b#:bd# " Windows nnoremap wq :windo bw noremap 10< noremap 10> noremap 4+ noremap 4- " MacVim has different alt codes so gotta check if gui_running, there are the codes in order " alt + ; " alt + o & alt + O " alt + h & alt + l " if has("gui_running") " inoremap » A; " nnoremap » A; " nnoremap ï ok " nnoremap Ï Oj " noremap è gT " noremap ì gt " noremap È :tabmove -1 " nnoremap Ì :tabmove +1 " else inoremap … A; nnoremap … A;; nnoremap ø ok nnoremap Ø Oj noremap ˙ gT noremap ¬ gt noremap Ó :tabmove -1 nnoremap Ò :tabmove +1 " Map vim-move in terminal vmap ∆ MoveBlockDown vmap ˚ MoveBlockUp nmap ∆ MoveLineDown nmap ˚ MoveLineUp " endif " open Help in vertical window if (!exists(":H")) command -nargs=* -complete=help H vertical belowright help endif augroup insert_mode_stuff autocmd! au InsertEnter * set cursorline au InsertLeave * set nocursorline autocmd BufNewFile,BufRead * setlocal formatoptions=t autocmd BufNewFile,BufRead * set colorcolumn=80 augroup END command! CDC cd %:p:h " Show syntax definition where cursor is placed func! SynStack() if !exists("*synstack") return endif echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunc nnoremap syn :call SynStack() " Toggle booleans func! ToggleBool() let l:word = expand("") if l:word ==? "true" let l:word = "false" elseif l:word ==? "false" let l:word = "true" elseif l:word ==? "public" let l:word = "protected" elseif l:word ==? "protected" let l:word = "private" elseif l:word ==? "private" let l:word = "public" else return "\" endif return "ciw" . l:word . "\" endfunc nnoremap ToggleBool() command! Retab set ts=2 noet | retab! | set et ts=4 | retab command! DeleteBadWhiteSpace %s/\s\+$//e | %s/^\s\+$//e | %s/\r//e command! Reformat %s/\(\\)(/\1 (/e | g/) {\$/normal $i/e " Searching set incsearch set ignorecase set smartcase set hlsearch nohlsearch " Appearance syntax on set number set t_Co=256 set linespace=2 if has("gui_running") set guifont=Andale\ Mono:h12 colorscheme jellybeans " colorscheme autumnleaf else " colorscheme solarized colorscheme jellybeans " Solarized " set background=dark endif func! SetFont(size) exec 'set guifont=Andale\ Mono:h' . a:size endfun command! -nargs=1 FontSize :call SetFont() " DelimitMate let g:delimitMate_expand_cr=1 let g:delitMate_expand_space=0 " CameCase Text Object map q CamelCaseMotion_w map Q CamelCaseMotion_b omap iq CamelCaseMotion_iw xmap iq CamelCaseMotion_iw " Parameter Text Object let g:no_parameter_object_maps = 1 vmap ia ParameterObjectI omap ia ParameterObjectI vmap aa ParameterObjectA omap aa ParameterObjectA " Easy Motion let g:EasyMotion_do_mapping=0 let g:EasyMotion_keys = 'asdfjkleirwuo' nmap , (easymotion-prefix) nmap S (easymotion-sl2) nmap ,f (easymotion-f) nmap ,F (easymotion-F) nmap ,t (easymotion-t) nmap ,T (easymotion-T) nmap ,w (easymotion-w) nmap ,W (easymotion-W) nmap ,b (easymotion-b) nmap ,B (easymotion-B) nmap ,e (easymotion-e) nmap ,E (easymotion-E) nmap ,ge (easymotion-ge) nmap ,gE (easymotion-gE) nmap ,j (easymotion-j) nmap ,k (easymotion-k) vmap ,j (easymotion-j) vmap ,k (easymotion-k) nmap ,n (easymotion-n) nmap ,N (easymotion-N) nmap ,s (easymotion-s2) nmap ,/ (easymotion-sn) " Clever-F let g:clever_f_across_no_line=1 " Incsearch.vim map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) let g:incsearch#consistent_n_direction = 1 let g:incsearch#emacs_like_keymap = 1 " Javascript Libraries let g:used_javascript_libs = 'jquery,angularjs,angularui,sugar' " Gundo noremap g :GundoToggle " Easy Align vmap (EasyAlign) nmap e (EasyAlign) " Go to URLs vnoremap du "uy:silent !open http://docs.unity3d.com/Documentation/ScriptReference/u.html nnoremap dg :call GoToUrl("google") nnoremap du :call GoToUrl("unity") nnoremap dm :call GoToUrl("msdn") fun! GoToUrl(options) let keyword = expand("") if (a:options == "google") let url = "http://www.google.com/search?q=" elseif (a:options == "unity") let url = "http://docs.unity3d.com/Documentation/ScriptReference/30_search.html?q=" elseif (a:options == "msdn") let url = "http://social.msdn.microsoft.com/Search/en-US?query=" endif exec '!open ' . url . keyword endfun " Scrolling Speed noremap :call smooth_scroll#up(&scroll, 10, 3) noremap :call smooth_scroll#down(&scroll, 10, 3) noremap :call smooth_scroll#up(&scroll*2, 10, 4) noremap :call smooth_scroll#down(&scroll*2, 10, 4) noremap :call smooth_scroll#up(&scroll/5, 15, 1) noremap :call smooth_scroll#down(&scroll/5, 15, 1) " Startify let g:startify_session_dir = "~/.vim/sessions/" let g:startify_list_order = [ ['SESSIONS'], 'sessions', ['FILES'], 'files', ['BOOKMARKS'], 'bookmarks', ] let g:startify_bookmarks = ["~/.vim/", "ftp://ftp.ferano.io//", "~/Documents/Work/", "~/Documents/Work/jflib/Assets/jflib/", "~/Documents/Work/jamtok/project/Assets/", "~/Documents/Work/poptok/Assets/Scripts"] let g:startify_files_number = 7 let g:startify_session_persistence = 1 let g:startify_enable_special = 0 " Load custom header :source ~/.vim/startify_header.vim " NERDTree let NERDTreeIgnore=['.meta$[[file]]'] " Emmet let g:user_emmet_leader_key='' let g:user_emmet_install_global = 0 augroup emmet_stuff autocmd FileType html,css EmmetInstall augroup END " MatchTagAlways highlight MatchParen ctermfg=black ctermbg=lightgreen guifg=#002b36 guibg=#b58900 " Ag.vim let g:agformat="%f:%l:%m" noremap a :Ag! let g:agprg="ag --column --smart-case" " C Stuff " augroup c_bindings " autocmd! " au FileType c noremap ) ?{w99[{:nohlsearch " au FileType c noremap ( j0?{w99[{%/{:nohlsearch " augroup END " Arduino augroup arduino_files autocmd! au BufRead,BufNewFile *.pde set filetype=arduino au BufRead,BufNewFile *.ino set filetype=arduino augroup END " let g:vim_arduino_library_path = "/Applications/Arduino.app" " let g:vim_arduino_serial_port = "/dev/tty.usbmodem1d1131" " Lua Stuff let g:lua_check_syntax = 0 let g:lua_complete_omni = 1 " Compile and run current C file nnoremap cc :!gcc -Wall -o %:r % nnoremap cr :!gcc -Wall -o %:r % && ./%:r let g:clang_library_path="/Users/josephferano/src/clang+llvm-3.3-x86_64-apple-darwin12/lib/libclang.dylib" " CtrlP set wildignore+=*/tmp/*,*/Temp/*,*/Library/*,*/Builds/*,*.png,*.jpg,*.asset,*.unity,*.csproj,*.gif,*.so,*.swp,*.zip,*.meta,*.ttc,*.userprefs,*.mat,*.mp3,*.ogg,*.wav,*.bmp,*.anim,*.TTF,tags let g:ctrlp_custom_ignore = { 'dir': '\v[\/](obj|bin|node_modules|bower_components)|(\.(swp|ico|git|svn))$', 'file': '\v\.(exe|so|dll|meta|prefab|unity3d|sln)$', 'link': 'some_bad_symbolic_links', } let g:ctrlp_map = 'p' noremap :CtrlP noremap m :CtrlPMRU noremap b :CtrlPBuffer noremap t :CtrlPBufTag noremap l :CtrlPLine noremap y :CtrlPYankring noremap c :CtrlPCmdline let g:ctrlp_match_window="ttb,min:1,max:15,results:15" let g:ctrlp_session_dir=".vim/sessions/" let g:ctrlp_by_filename = 1 let g:ctrlp_working_path_mode = '' let g:ctrlp_buffer_func = { 'enter': 'CtrlpMaps' } func! CtrlpMaps() nnoremap :call DeleteBuffer() " nnoremap :call QuickLook() endfunc func! s:QuickLook() let line = getline('.') let l:path = getcwd() . substitute(line, '> ', '/', "") call system("qlmanage -p 2>/dev/null '" . path . "'") endfunc func! s:DeleteBuffer() let line = getline('.') let bufid = line =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(line, '\d\+')) \ : fnamemodify(line[2:], ':p') exec "bd" bufid exec "norm \" endfunc " Syntastic let g:syntastic_cs_checkers = ['syntax'] " OmniSharp augroup omnisharp_complete autocmd! autocmd FileType cs set commentstring=//\ %s autocmd FileType cs setlocal omnifunc=OmniSharp#Complete autocmd FileType cs nnoremap og :OmniSharpGotoDefinition autocmd FileType cs nnoremap ofi :OmniSharpFindImplementations autocmd FileType cs nnoremap ofu :OmniSharpFindUsages autocmd FileType cs nnoremap odc :OmniSharpDocumentation autocmd FileType cs nnoremap oft :OmniSharpFindType autocmd FileType cs nnoremap ofs :OmniSharpFindSymbol autocmd FileType cs nnoremap ofm :OmniSharpFindMembers autocmd FileType cs nnoremap oht :OmniSharpHighlightTypes autocmd FileType cs nnoremap orl :OmniSharpReloadSolution autocmd FileType cs nnoremap oso :OmniSharpStopServer autocmd FileType cs nnoremap osa :OmniSharpStartServer autocmd FileType cs nnoremap oad :OmniSharpAddToProject autocmd FileType cs nnoremap ob :OmniSharpBuildAsync autocmd FileType cs nnoremap orn :OmniSharpRenameToh autocmd FileType cs nnoremap oca :OmniSharpGetCodeActions autocmd FileType cs vnoremap oca :call OmniSharp#GetCodeActions('visual') autocmd FileType cs nnoremap f :OmniSharpTypeLookup autocmd FileType cs nnoremap F mmF(h:OmniSharpTypeLookup`m autocmd FileType cs nnoremap ( :OmniSharpNavigateDown autocmd FileType cs nnoremap ) :OmniSharpNavigateUp augroup END set completeopt=longest,menuone let g:OmniSharp_typeLookupInPreview = 0 let g:OmniSharp_timeout = 100 if has("gui_running") hi link csAttributeType Constant hi link csUnspecifiedStatement Constant hi link csInterfaceDeclaration Repeat else hi link csAttributeType Special hi link csUnspecifiedStatement PreProc hi link csInterfaceDeclaration StorageClass hi link csModifier Identifier hi link csClass Constant hi link csType Constant hi link CSharpUserType Identifier endif " source ~/Documents/Work/vim-csharp-repl/plugin/csharp-repl.vim " NeoComplete let g:acp_enableAtStartup = 0 let g:neocomplete#enable_at_startup = 1 let g:neocomplete#enable_smart_case = 1 let g:neocomplete#sources#syntax#min_keyword_length = 2 let g:neocomplete#max_list = 25 let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' let g:neocomplete#sources#dictionary#dictionaries = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } call neocomplete#custom#source('_', 'sorters', []) if !exists('g:neocomplete#sources') let g:neocomplete#sources = {} endif if !exists('g:neocomplete#keyword_patterns') let g:neocomplete#keyword_patterns = {} endif let g:neocomplete#keyword_patterns['default'] = '\h\w*' let g:neocomplete#enable_auto_select = 1 let g:neocomplete#disable_auto_complete = 0 inoremap neocomplete#complete_common_string() inoremap pumvisible() ? neocomplete#cancel_popup() : "\" imap pumvisible() ? neocomplete#close_popup() : "\" if !exists('g:neocomplete#sources#omni#input_patterns') let g:neocomplete#sources#omni#input_patterns = {} endif let g:neocomplete#force_overwrite_completefunc = 1 let g:neocomplete#sources.cs = ['omni'] let g:neocomplete#sources#omni#input_patterns.cs = '.*[^-!@%?/|&\{}\+\*\(<>\")\=);]' let g:neocomplete#sources#omni#input_patterns.js = '[^. \t]\.\w*' let g:neocomplete#sources#omni#input_patterns.c = '[^[:digit:] *;\{\()]\w*' let g:neocomplete#sources#omni#input_patterns.lua = '[^. \t]\.\w*' let g:clang_complete_auto=1 let g:clang_auto_select=0 let g:clang_use_library=1 let g:neocomplete#enable_refresh_always = 0 augroup js_aus autocmd! autocmd FileType javascript setlocal omnifunc=tern#Complete autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags augroup END " NeoSnippet imap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : "\" smap (neosnippet_expand_or_jump) xmap (neosnippet_expand_target) let g:neosnippet#enable_snipmate_compatibility = 1 let g:neosnippet#snippets_directory='~/.vim/snippet' smap neosnippet#expandable_or_jumpable() ? \ "\(neosnippet_expand_or_jump)" \: "\" if has('conceal') set conceallevel=2 concealcursor=i endif "