disable some plugins I don't currently use
[~bandali/configs] / vim / .vimrc
1 " ==== <Vundle> ====
2 set nocompatible " be iMproved, required
3 filetype off " required
4
5 " set the runtime path to include Vundle and initialize
6 set rtp+=~/.vim/bundle/Vundle.vim
7 call vundle#begin()
8
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 "Plugin 'elzr/vim-json'
25 "Plugin 'lervag/vim-latex'
26 call vundle#end() " required
27 " ==== </Vundle> ====
28
29 " Use the Solarized Dark theme
30 set background=dark
31 "colorscheme solarized
32
33 " Make Vim more useful
34 set nocompatible
35 " Use the OS clipboard by default (on versions compiled with `+clipboard`)
36 set clipboard=unnamed
37 " Enhance command-line completion
38 set wildmenu
39 " Allow cursor keys in insert mode
40 set esckeys
41 " Allow backspace in insert mode
42 set backspace=indent,eol,start
43 " Optimize for fast terminal connections
44 set ttyfast
45 " Add the g flag to search/replace by default
46 set gdefault
47 " Use UTF-8 without BOM
48 set encoding=utf-8 nobomb
49 " Change mapleader
50 let mapleader=","
51 " Don’t add empty newlines at the end of files
52 set binary
53 set noeol
54 " Centralize backups, swapfiles and undo history
55 set backupdir=~/.vim/backups
56 set directory=~/.vim/swaps
57 if exists("&undodir")
58 set undodir=~/.vim/undo
59 endif
60 set undofile
61
62 " Don’t create backups when editing files in certain directories
63 set backupskip=/tmp/*,/private/tmp/*
64
65 " Respect modeline in files
66 set modeline
67 set modelines=4
68 " Enable per-directory .vimrc files and disable unsafe commands in them
69 set exrc
70 set secure
71 " Enable line numbers
72 set number
73 " Enable syntax highlighting
74 syntax on
75 " Highlight current line
76 "set cursorline
77 " Make tabs as wide as two spaces
78 set tabstop=4
79 " Show “invisible” characters
80 set lcs=tab:▸\ ,eol:\ \,nbsp:_
81 " set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
82 set list
83 " Highlight searches
84 set hlsearch
85 " Ignore case of searches
86 set ignorecase
87 " Highlight dynamically as pattern is typed
88 set incsearch
89 " Always show status line
90 set laststatus=2
91 " Enable mouse in all modes
92 set mouse=a
93 " Disable error bells
94 set noerrorbells
95 " Don’t reset cursor to start of line when moving around.
96 set nostartofline
97 " Show the cursor position
98 set ruler
99 " Don’t show the intro message when starting Vim
100 set shortmess=atI
101 " Show the current mode
102 set showmode
103 " Show the filename in the window titlebar
104 set title
105 " Show the (partial) command as it’s being typed
106 set showcmd
107 " Use relative line numbers
108 if exists("&relativenumber")
109 set relativenumber
110 au BufReadPost * set relativenumber
111 endif
112 " Start scrolling three lines before the horizontal window border
113 set scrolloff=3
114
115 " Strip trailing whitespace (,ss)
116 function! StripWhitespace()
117 let save_cursor = getpos(".")
118 let old_query = getreg('/')
119 :%s/\s\+$//e
120 call setpos('.', save_cursor)
121 call setreg('/', old_query)
122 endfunction
123 noremap <leader>ss :call StripWhitespace()<CR>
124 " Save a file as root (,W)
125 noremap <leader>W :w !sudo tee % > /dev/null<CR>
126
127 " Automatic commands
128 if has("autocmd")
129 " Enable file type detection
130 filetype plugin indent on
131 " Treat .json files as .js
132 autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
133 endif
134
135 " Enable pathogen
136 "execute pathogen#infect()
137
138 " swap ; and :
139 nnoremap ; :
140 nnoremap : ;
141 vnoremap ; :
142 vnoremap : ;
143
144 " relative line number stuff
145 function! NumberToggle()
146 if(&relativenumber == 1)
147 set number
148 else
149 set relativenumber
150 endif
151 endfunc
152 nnoremap <leader>n :call NumberToggle()<cr>
153 ":au FocusLost * :set number
154 ":au FocusGained * :set relativenumber
155 autocmd InsertEnter * :set number
156 autocmd InsertEnter * :set norelativenumber
157 autocmd InsertLeave * :set relativenumber
158 "autocmd InsertLeave * :set nonumber
159
160 " Rainbow Parantheses
161 au Syntax * RainbowParenthesesLoadRound
162 au Syntax * RainbowParenthesesLoadSquare
163 au Syntax * RainbowParenthesesLoadBraces
164 noremap <leader>m :RainbowParenthesesToggle<CR>
165
166
167 " ==== <UltiSnips> ====
168 " Trigger configuration. Do not use <tab> if you use
169 " https://github.com/Valloric/YouCompleteMe.
170 let g:UltiSnipsExpandTrigger="<tab>"
171 "let g:UltiSnipsJumpForwardTrigger="<c-b>"
172 let g:UltiSnipsJumpForwardTrigger="<tab>"
173 "let g:UltiSnipsJumpBackwardTrigger="<c-z>"
174 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
175 " ==== </UltiSnips> ====
176
177 " Spaces FTW
178 set shiftwidth=4
179 set expandtab
180
181 "let g:ctrlp_map = '<space>'
182 let g:ctrlp_map = '<leader>p'
183 set wildignore+=*/build/**
184 let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
185 let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
186 let gradle_path= '~/.gradle/'
187 let g:android_build_type= 'gradle'
188
189 let delimitMate_expand_space=1
190 let delimitMate_expand_cr=2
191
192 let g:indentLine_enabled=1
193 "let g:indentLine_color_term = 239
194 "let g:indentLine_color_gui = '#09AA08'
195 "let g:indentLine_char = '│'
196 let g:indentLine_char = '¦'
197
198 " ctrlp {
199 if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
200 let g:ctrlp_working_path_mode = 'ra'
201 nnoremap <silent> <D-t> :CtrlP<CR>
202 nnoremap <silent> <D-r> :CtrlPMRU<CR>
203 let g:ctrlp_custom_ignore = {
204 \ 'dir': '\.git$\|\.hg$\|\.svn$',
205 \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
206
207 " On Windows use "dir" as fallback command.
208 if executable('ag')
209 let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
210 elseif executable('ack-grep')
211 let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
212 elseif executable('ack')
213 let s:ctrlp_fallback = 'ack %s --nocolor -f'
214 else
215 let s:ctrlp_fallback = 'find %s -type f'
216 endif
217 let g:ctrlp_user_command = {
218 \ 'types': {
219 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
220 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
221 \ },
222 \ 'fallback': s:ctrlp_fallback
223 \ }
224
225 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
226 " CtrlP extensions
227 let g:ctrlp_extensions = ['funky']
228
229 "funky
230 nnoremap <Leader>fu :CtrlPFunky<Cr>
231 endif
232 endif
233 "}
234 "
235
236 " change cursor shape based on mode
237 let &t_SI = "\<Esc>]50;CursorShape=1\x7"
238 let &t_EI = "\<Esc>]50;CursorShape=0\x7"
239
240 set pastetoggle=<leader>t
241
242 "set conceallevel=0
243 "let g:vim_json_syntax_conceal = 0
244 "let g:indentLine_noConcealCursor=""