2 set nocompatible " be iMproved, required
3 filetype off " required
5 " set the runtime path to include Vundle and initialize
6 set rtp+=~/.vim/bundle/Vundle.vim
9 " let Vundle manage Vundle, required
10 Plugin 'gmarik/Vundle.vim'
11 Plugin 'kien/rainbow_parentheses.vim'
12 Plugin 'hsanson/vim-android'
13 Plugin 'scrooloose/nerdcommenter'
14 Plugin 'SirVer/ultisnips'
15 Plugin 'honza/vim-snippets'
16 Plugin 'kien/ctrlp.vim'
17 Plugin 'tacahiroy/ctrlp-funky'
18 Plugin 'Raimondi/delimitMate'
19 Plugin 'Yggdroot/indentLine'
20 "Plugin 'tpope/vim-fugitive'
21 Plugin 'airblade/vim-gitgutter'
22 "Plugin 'altercation/vim-colors-solarized'
23 Plugin 'terryma/vim-multiple-cursors'
24 call vundle#end() " required
27 " Use the Solarized Dark theme
29 "colorscheme solarized
31 " Make Vim more useful
33 " Use the OS clipboard by default (on versions compiled with `+clipboard`)
35 " Enhance command-line completion
37 " Allow cursor keys in insert mode
39 " Allow backspace in insert mode
40 set backspace=indent,eol,start
41 " Optimize for fast terminal connections
43 " Add the g flag to search/replace by default
45 " Use UTF-8 without BOM
46 set encoding=utf-8 nobomb
49 " Don’t add empty newlines at the end of files
52 " Centralize backups, swapfiles and undo history
53 set backupdir=~/.vim/backups
54 set directory=~/.vim/swaps
56 set undodir=~/.vim/undo
60 " Don’t create backups when editing files in certain directories
61 set backupskip=/tmp/*,/private/tmp/*
63 " Respect modeline in files
66 " Enable per-directory .vimrc files and disable unsafe commands in them
71 " Enable syntax highlighting
73 " Highlight current line
75 " Make tabs as wide as two spaces
77 " Show “invisible” characters
78 set lcs=tab:▸\ ,eol:\ \,nbsp:_
79 " set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
83 " Ignore case of searches
85 " Highlight dynamically as pattern is typed
87 " Always show status line
89 " Enable mouse in all modes
93 " Don’t reset cursor to start of line when moving around.
95 " Show the cursor position
97 " Don’t show the intro message when starting Vim
99 " Show the current mode
101 " Show the filename in the window titlebar
103 " Show the (partial) command as it’s being typed
105 " Use relative line numbers
106 if exists("&relativenumber")
108 au BufReadPost * set relativenumber
110 " Start scrolling three lines before the horizontal window border
113 " Strip trailing whitespace (,ss)
114 function! StripWhitespace()
115 let save_cursor = getpos(".")
116 let old_query = getreg('/')
118 call setpos('.', save_cursor)
119 call setreg('/', old_query)
121 noremap <leader>ss :call StripWhitespace()<CR>
122 " Save a file as root (,W)
123 noremap <leader>W :w !sudo tee % > /dev/null<CR>
127 " Enable file type detection
128 filetype plugin indent on
129 " Treat .json files as .js
130 autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
134 "execute pathogen#infect()
142 " relative line number stuff
143 function! NumberToggle()
144 if(&relativenumber == 1)
150 nnoremap <leader>n :call NumberToggle()<cr>
151 ":au FocusLost * :set number
152 ":au FocusGained * :set relativenumber
153 autocmd InsertEnter * :set number
154 autocmd InsertEnter * :set norelativenumber
155 autocmd InsertLeave * :set relativenumber
156 "autocmd InsertLeave * :set nonumber
158 " Rainbow Parantheses
159 au Syntax * RainbowParenthesesLoadRound
160 au Syntax * RainbowParenthesesLoadSquare
161 au Syntax * RainbowParenthesesLoadBraces
162 noremap <leader>m :RainbowParenthesesToggle<CR>
165 " ==== <UltiSnips> ====
166 " Trigger configuration. Do not use <tab> if you use
167 " https://github.com/Valloric/YouCompleteMe.
168 let g:UltiSnipsExpandTrigger="<tab>"
169 "let g:UltiSnipsJumpForwardTrigger="<c-b>"
170 let g:UltiSnipsJumpForwardTrigger="<tab>"
171 "let g:UltiSnipsJumpBackwardTrigger="<c-z>"
172 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
173 " ==== </UltiSnips> ====
179 "let g:ctrlp_map = '<space>'
180 let g:ctrlp_map = '<leader>p'
181 set wildignore+=*/build/**
182 let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
183 let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
184 let gradle_path= '~/.gradle/'
185 let g:android_build_type= 'gradle'
187 let delimitMate_expand_space=1
188 let delimitMate_expand_cr=2
190 let g:indentLine_enabled=1
191 "let g:indentLine_color_term = 239
192 "let g:indentLine_color_gui = '#09AA08'
193 "let g:indentLine_char = '│'
194 let g:indentLine_char = '¦'
197 if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
198 let g:ctrlp_working_path_mode = 'ra'
199 nnoremap <silent> <D-t> :CtrlP<CR>
200 nnoremap <silent> <D-r> :CtrlPMRU<CR>
201 let g:ctrlp_custom_ignore = {
202 \ 'dir': '\.git$\|\.hg$\|\.svn$',
203 \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
205 " On Windows use "dir" as fallback command.
207 let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
208 elseif executable('ack-grep')
209 let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
210 elseif executable('ack')
211 let s:ctrlp_fallback = 'ack %s --nocolor -f'
213 let s:ctrlp_fallback = 'find %s -type f'
215 let g:ctrlp_user_command = {
217 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
218 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
220 \ 'fallback': s:ctrlp_fallback
223 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
225 let g:ctrlp_extensions = ['funky']
228 nnoremap <Leader>fu :CtrlPFunky<Cr>
234 " change cursor shape based on mode
235 let &t_SI = "\<Esc>]50;CursorShape=1\x7"
236 let &t_EI = "\<Esc>]50;CursorShape=0\x7"
238 set pastetoggle=<leader>t