use pulse with mpd
[~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 call vundle#end() " required
25 " ==== </Vundle> ====
26
27 " Use the Solarized Dark theme
28 set background=dark
29 "colorscheme solarized
30
31 " Make Vim more useful
32 set nocompatible
33 " Use the OS clipboard by default (on versions compiled with `+clipboard`)
34 set clipboard=unnamed
35 " Enhance command-line completion
36 set wildmenu
37 " Allow cursor keys in insert mode
38 set esckeys
39 " Allow backspace in insert mode
40 set backspace=indent,eol,start
41 " Optimize for fast terminal connections
42 set ttyfast
43 " Add the g flag to search/replace by default
44 set gdefault
45 " Use UTF-8 without BOM
46 set encoding=utf-8 nobomb
47 " Change mapleader
48 let mapleader=","
49 " Don’t add empty newlines at the end of files
50 set binary
51 set noeol
52 " Centralize backups, swapfiles and undo history
53 set backupdir=~/.vim/backups
54 set directory=~/.vim/swaps
55 if exists("&undodir")
56 set undodir=~/.vim/undo
57 endif
58 set undofile
59
60 " Don’t create backups when editing files in certain directories
61 set backupskip=/tmp/*,/private/tmp/*
62
63 " Respect modeline in files
64 set modeline
65 set modelines=4
66 " Enable per-directory .vimrc files and disable unsafe commands in them
67 set exrc
68 set secure
69 " Enable line numbers
70 set number
71 " Enable syntax highlighting
72 syntax on
73 " Highlight current line
74 "set cursorline
75 " Make tabs as wide as two spaces
76 set tabstop=4
77 " Show “invisible” characters
78 set lcs=tab:▸\ ,eol:\ \,nbsp:_
79 " set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
80 set list
81 " Highlight searches
82 set hlsearch
83 " Ignore case of searches
84 set ignorecase
85 " Highlight dynamically as pattern is typed
86 set incsearch
87 " Always show status line
88 set laststatus=2
89 " Enable mouse in all modes
90 set mouse=a
91 " Disable error bells
92 set noerrorbells
93 " Don’t reset cursor to start of line when moving around.
94 set nostartofline
95 " Show the cursor position
96 set ruler
97 " Don’t show the intro message when starting Vim
98 set shortmess=atI
99 " Show the current mode
100 set showmode
101 " Show the filename in the window titlebar
102 set title
103 " Show the (partial) command as it’s being typed
104 set showcmd
105 " Use relative line numbers
106 if exists("&relativenumber")
107 set relativenumber
108 au BufReadPost * set relativenumber
109 endif
110 " Start scrolling three lines before the horizontal window border
111 set scrolloff=3
112
113 " Strip trailing whitespace (,ss)
114 function! StripWhitespace()
115 let save_cursor = getpos(".")
116 let old_query = getreg('/')
117 :%s/\s\+$//e
118 call setpos('.', save_cursor)
119 call setreg('/', old_query)
120 endfunction
121 noremap <leader>ss :call StripWhitespace()<CR>
122 " Save a file as root (,W)
123 noremap <leader>W :w !sudo tee % > /dev/null<CR>
124
125 " Automatic commands
126 if has("autocmd")
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
131 endif
132
133 " Enable pathogen
134 "execute pathogen#infect()
135
136 " swap ; and :
137 nnoremap ; :
138 nnoremap : ;
139 vnoremap ; :
140 vnoremap : ;
141
142 " relative line number stuff
143 function! NumberToggle()
144 if(&relativenumber == 1)
145 set number
146 else
147 set relativenumber
148 endif
149 endfunc
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
157
158 " Rainbow Parantheses
159 au Syntax * RainbowParenthesesLoadRound
160 au Syntax * RainbowParenthesesLoadSquare
161 au Syntax * RainbowParenthesesLoadBraces
162 noremap <leader>m :RainbowParenthesesToggle<CR>
163
164
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> ====
174
175 " Spaces FTW
176 set shiftwidth=4
177 set expandtab
178
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'
186
187 let delimitMate_expand_space=1
188 let delimitMate_expand_cr=2
189
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 = '¦'
195
196 " ctrlp {
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$' }
204
205 " On Windows use "dir" as fallback command.
206 if executable('ag')
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'
212 else
213 let s:ctrlp_fallback = 'find %s -type f'
214 endif
215 let g:ctrlp_user_command = {
216 \ 'types': {
217 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
218 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
219 \ },
220 \ 'fallback': s:ctrlp_fallback
221 \ }
222
223 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
224 " CtrlP extensions
225 let g:ctrlp_extensions = ['funky']
226
227 "funky
228 nnoremap <Leader>fu :CtrlPFunky<Cr>
229 endif
230 endif
231 "}
232 "
233
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"
237
238 set pastetoggle=<leader>t
239