1 "set nocompatible " be iMproved, required
2 "filetype off " required
4 call plug#begin('~/.vim/plugged')
6 Plug 'kien/rainbow_parentheses.vim'
7 "Plug 'hsanson/vim-android'
8 Plug 'scrooloose/nerdcommenter'
9 Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
10 "Plug 'kien/ctrlp.vim'
11 "Plug 'tacahiroy/ctrlp-funky'
12 Plug 'Raimondi/delimitMate'
13 Plug 'Yggdroot/indentLine'
14 "Plug 'tpope/vim-fugitive'
15 Plug 'airblade/vim-gitgutter'
16 "Plug 'altercation/vim-colors-solarized'
17 Plug 'terryma/vim-multiple-cursors'
19 "Plug 'lervag/vim-latex'
20 Plug 'tpope/vim-surround'
21 Plug 'rust-lang/rust.vim'
22 Plug 'phildawes/racer'
23 Plug 'whatyouhide/vim-gotham'
28 " Use the Solarized Dark theme
32 " Make Vim more useful
34 " Use the OS clipboard by default (on versions compiled with `+clipboard`)
35 set clipboard=unnamedplus
36 " Enhance command-line completion
38 " Allow cursor keys in insert mode
40 " Allow backspace in insert mode
41 set backspace=indent,eol,start
42 " Optimize for fast terminal connections
44 " Add the g flag to search/replace by default
46 " Use UTF-8 without BOM
47 set encoding=utf-8 nobomb
50 " Don’t add empty newlines at the end of files
53 " Centralize backups, swapfiles and undo history
54 set backupdir=~/.vim/backups
55 set directory=~/.vim/swaps
57 set undodir=~/.vim/undo
61 " Don’t create backups when editing files in certain directories
62 set backupskip=/tmp/*,/private/tmp/*
64 " Respect modeline in files
67 " Enable per-directory .vimrc files and disable unsafe commands in them
72 " Enable syntax highlighting
74 " Highlight current line
76 " Make tabs as wide as two spaces
78 " Show “invisible” characters
79 set lcs=tab:▸\ ,eol:\ \,nbsp:_
80 " set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
84 " Ignore case of searches
86 " Highlight dynamically as pattern is typed
88 " Always show status line
90 " Enable mouse in all modes
94 " Don’t reset cursor to start of line when moving around.
96 " Show the cursor position
98 " Don’t show the intro message when starting Vim
100 " Show the current mode
102 " Show the filename in the window titlebar
104 " Show the (partial) command as it’s being typed
106 " Use relative line numbers
107 if exists("&relativenumber")
109 au BufReadPost * set relativenumber
111 " Start scrolling three lines before the horizontal window border
114 " Strip trailing whitespace (,ss)
115 function! StripWhitespace()
116 let save_cursor = getpos(".")
117 let old_query = getreg('/')
119 call setpos('.', save_cursor)
120 call setreg('/', old_query)
122 noremap <leader>ss :call StripWhitespace()<CR>
123 " Save a file as root (,W)
124 noremap <leader>W :w !sudo tee % > /dev/null<CR>
128 " Enable file type detection
129 filetype plugin indent on
130 " Treat .json files as .js
131 autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
135 "execute pathogen#infect()
143 " relative line number stuff
144 function! NumberToggle()
145 if(&relativenumber == 1)
151 nnoremap <leader>n :call NumberToggle()<cr>
152 ":au FocusLost * :set number
153 ":au FocusGained * :set relativenumber
154 autocmd InsertEnter * :set number
155 autocmd InsertEnter * :set norelativenumber
156 autocmd InsertLeave * :set relativenumber
157 "autocmd InsertLeave * :set nonumber
159 " Rainbow Parantheses
160 au Syntax * RainbowParenthesesLoadRound
161 au Syntax * RainbowParenthesesLoadSquare
162 au Syntax * RainbowParenthesesLoadBraces
163 noremap <leader>m :RainbowParenthesesToggle<CR>
166 " ==== <UltiSnips> ====
167 " Trigger configuration. Do not use <tab> if you use
168 " https://github.com/Valloric/YouCompleteMe.
169 let g:UltiSnipsExpandTrigger="<tab>"
170 "let g:UltiSnipsJumpForwardTrigger="<c-b>"
171 let g:UltiSnipsJumpForwardTrigger="<tab>"
172 "let g:UltiSnipsJumpBackwardTrigger="<c-z>"
173 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
174 " ==== </UltiSnips> ====
180 let g:ctrlp_map = '<space>'
181 "let g:ctrlp_map = '<leader>p'
182 set wildignore+=*/build/**
183 let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
184 let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
185 let gradle_path= '~/.gradle/'
186 let g:android_build_type= 'gradle'
188 let delimitMate_expand_space=1
189 let delimitMate_expand_cr=2
191 let g:indentLine_enabled=1
192 "let g:indentLine_color_term = 239
193 "let g:indentLine_color_gui = '#09AA08'
194 "let g:indentLine_char = '│'
195 let g:indentLine_char = '¦'
198 if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
199 let g:ctrlp_working_path_mode = 'ra'
200 nnoremap <silent> <D-t> :CtrlP<CR>
201 nnoremap <silent> <D-r> :CtrlPMRU<CR>
202 let g:ctrlp_custom_ignore = {
203 \ 'dir': '\.git$\|\.hg$\|\.svn$',
204 \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
206 " On Windows use "dir" as fallback command.
208 let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
209 elseif executable('ack-grep')
210 let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
211 elseif executable('ack')
212 let s:ctrlp_fallback = 'ack %s --nocolor -f'
214 let s:ctrlp_fallback = 'find %s -type f'
216 let g:ctrlp_user_command = {
218 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
219 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
221 \ 'fallback': s:ctrlp_fallback
224 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
226 let g:ctrlp_extensions = ['funky']
229 nnoremap <Leader>fu :CtrlPFunky<Cr>
235 " change cursor shape based on mode
236 let &t_SI = "\<Esc>]50;CursorShape=1\x7"
237 let &t_EI = "\<Esc>]50;CursorShape=0\x7"
239 set pastetoggle=<leader>p
242 "let g:vim_json_syntax_conceal = 0
243 "let g:indentLine_noConcealCursor=""
244 " latex mode settings
245 let g:Tex_DefaultTargetFormat = "pdf"
248 let g:racer_cmd = "racer"
249 let $RUST_SRC_PATH=expand('~/misc/rs/rust/src/')