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