add dunst config
[~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'
b55b6430 12"Plugin 'hsanson/vim-android'
debd020d
AB
13Plugin 'scrooloose/nerdcommenter'
14Plugin 'SirVer/ultisnips'
15Plugin 'honza/vim-snippets'
b55b6430
AB
16"Plugin 'kien/ctrlp.vim'
17"Plugin 'tacahiroy/ctrlp-funky'
debd020d
AB
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'
b55b6430
AB
24"Plugin 'elzr/vim-json'
25"Plugin 'lervag/vim-latex'
debd020d
AB
26call vundle#end() " required
27" ==== </Vundle> ====
28
29" Use the Solarized Dark theme
30set background=dark
31"colorscheme solarized
32
33" Make Vim more useful
34set nocompatible
35" Use the OS clipboard by default (on versions compiled with `+clipboard`)
36set clipboard=unnamed
37" Enhance command-line completion
38set wildmenu
39" Allow cursor keys in insert mode
40set esckeys
41" Allow backspace in insert mode
42set backspace=indent,eol,start
43" Optimize for fast terminal connections
44set ttyfast
45" Add the g flag to search/replace by default
46set gdefault
47" Use UTF-8 without BOM
48set encoding=utf-8 nobomb
49" Change mapleader
50let mapleader=","
51" Don’t add empty newlines at the end of files
52set binary
53set noeol
54" Centralize backups, swapfiles and undo history
55set backupdir=~/.vim/backups
56set directory=~/.vim/swaps
57if exists("&undodir")
58 set undodir=~/.vim/undo
59endif
60set undofile
61
62" Don’t create backups when editing files in certain directories
63set backupskip=/tmp/*,/private/tmp/*
64
65" Respect modeline in files
66set modeline
67set modelines=4
68" Enable per-directory .vimrc files and disable unsafe commands in them
69set exrc
70set secure
71" Enable line numbers
72set number
73" Enable syntax highlighting
74syntax on
75" Highlight current line
76"set cursorline
77" Make tabs as wide as two spaces
78set tabstop=4
79" Show “invisible” characters
80set lcs=tab:▸\ ,eol:\ \,nbsp:_
81" set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
82set list
83" Highlight searches
84set hlsearch
85" Ignore case of searches
86set ignorecase
87" Highlight dynamically as pattern is typed
88set incsearch
89" Always show status line
90set laststatus=2
91" Enable mouse in all modes
92set mouse=a
93" Disable error bells
94set noerrorbells
95" Don’t reset cursor to start of line when moving around.
96set nostartofline
97" Show the cursor position
98set ruler
99" Don’t show the intro message when starting Vim
100set shortmess=atI
101" Show the current mode
102set showmode
103" Show the filename in the window titlebar
104set title
105" Show the (partial) command as it’s being typed
106set showcmd
107" Use relative line numbers
108if exists("&relativenumber")
109 set relativenumber
110 au BufReadPost * set relativenumber
111endif
112" Start scrolling three lines before the horizontal window border
113set scrolloff=3
114
115" Strip trailing whitespace (,ss)
116function! 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)
122endfunction
123noremap <leader>ss :call StripWhitespace()<CR>
124" Save a file as root (,W)
125noremap <leader>W :w !sudo tee % > /dev/null<CR>
126
127" Automatic commands
128if 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
133endif
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
145function! NumberToggle()
146 if(&relativenumber == 1)
147 set number
148 else
149 set relativenumber
150 endif
151endfunc
152nnoremap <leader>n :call NumberToggle()<cr>
153":au FocusLost * :set number
154":au FocusGained * :set relativenumber
155autocmd InsertEnter * :set number
156autocmd InsertEnter * :set norelativenumber
157autocmd InsertLeave * :set relativenumber
158"autocmd InsertLeave * :set nonumber
159
160" Rainbow Parantheses
161au Syntax * RainbowParenthesesLoadRound
162au Syntax * RainbowParenthesesLoadSquare
163au Syntax * RainbowParenthesesLoadBraces
164noremap <leader>m :RainbowParenthesesToggle<CR>
165
166
167" ==== <UltiSnips> ====
168" Trigger configuration. Do not use <tab> if you use
169" https://github.com/Valloric/YouCompleteMe.
170let g:UltiSnipsExpandTrigger="<tab>"
171"let g:UltiSnipsJumpForwardTrigger="<c-b>"
172let g:UltiSnipsJumpForwardTrigger="<tab>"
173"let g:UltiSnipsJumpBackwardTrigger="<c-z>"
174let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
175" ==== </UltiSnips> ====
176
177" Spaces FTW
178set shiftwidth=4
179set expandtab
180
181"let g:ctrlp_map = '<space>'
182let g:ctrlp_map = '<leader>p'
183set wildignore+=*/build/**
184let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
185let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
186let gradle_path= '~/.gradle/'
187let g:android_build_type= 'gradle'
188
189let delimitMate_expand_space=1
190let delimitMate_expand_cr=2
191
192let g:indentLine_enabled=1
193"let g:indentLine_color_term = 239
194"let g:indentLine_color_gui = '#09AA08'
195"let g:indentLine_char = '│'
196let 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
237let &t_SI = "\<Esc>]50;CursorShape=1\x7"
238let &t_EI = "\<Esc>]50;CursorShape=0\x7"
239
240set pastetoggle=<leader>t
241
b55b6430
AB
242"set conceallevel=0
243"let g:vim_json_syntax_conceal = 0
244"let g:indentLine_noConcealCursor=""