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 ":au FocusLost * :set number
144 ":au FocusGained * :set relativenumber
145 autocmd InsertEnter * :set number
146 autocmd InsertEnter * :set norelativenumber
147 autocmd InsertLeave * :set relativenumber
148 "autocmd InsertLeave * :set nonumber
150 " Rainbow Parantheses
151 au Syntax * RainbowParenthesesLoadRound
152 au Syntax * RainbowParenthesesLoadSquare
153 au Syntax * RainbowParenthesesLoadBraces
154 noremap <leader>m :RainbowParenthesesToggle<CR>
157 " ==== <UltiSnips> ====
158 " Trigger configuration. Do not use <tab> if you use
159 " https://github.com/Valloric/YouCompleteMe.
160 let g:UltiSnipsExpandTrigger="<tab>"
161 "let g:UltiSnipsJumpForwardTrigger="<c-b>"
162 let g:UltiSnipsJumpForwardTrigger="<tab>"
163 "let g:UltiSnipsJumpBackwardTrigger="<c-z>"
164 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
165 " ==== </UltiSnips> ====
171 let g:ctrlp_map = '<space>'
172 "let g:ctrlp_map = '<leader>p'
173 set wildignore+=*/build/**
174 let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
175 let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
176 let gradle_path= '~/.gradle/'
177 let g:android_build_type= 'gradle'
179 let delimitMate_expand_space=1
180 let delimitMate_expand_cr=2
182 let g:indentLine_enabled=1
183 "let g:indentLine_color_term = 239
184 "let g:indentLine_color_gui = '#09AA08'
185 "let g:indentLine_char = '│'
186 let g:indentLine_char = '¦'
189 if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
190 let g:ctrlp_working_path_mode = 'ra'
191 nnoremap <silent> <D-t> :CtrlP<CR>
192 nnoremap <silent> <D-r> :CtrlPMRU<CR>
193 let g:ctrlp_custom_ignore = {
194 \ 'dir': '\.git$\|\.hg$\|\.svn$',
195 \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
197 " On Windows use "dir" as fallback command.
199 let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
200 elseif executable('ack-grep')
201 let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
202 elseif executable('ack')
203 let s:ctrlp_fallback = 'ack %s --nocolor -f'
205 let s:ctrlp_fallback = 'find %s -type f'
207 let g:ctrlp_user_command = {
209 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
210 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
212 \ 'fallback': s:ctrlp_fallback
215 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
217 let g:ctrlp_extensions = ['funky']
220 nnoremap <Leader>fu :CtrlPFunky<Cr>
226 " change cursor shape based on mode
227 let &t_SI = "\<Esc>]50;CursorShape=1\x7"
228 let &t_EI = "\<Esc>]50;CursorShape=0\x7"
230 set pastetoggle=<leader>p
233 "let g:vim_json_syntax_conceal = 0
234 "let g:indentLine_noConcealCursor=""
235 " latex mode settings
236 let g:Tex_DefaultTargetFormat = "pdf"
239 let g:racer_cmd = "racer"
240 let $RUST_SRC_PATH=expand('~/misc/rs/rust/src/')