-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
248 lines (188 loc) · 6.51 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
"------------------------------------------------------------
" Vundle setup https://github.com/gmarik/vundle
"------------------------------------------------------------
set nocompatible " be iMproved
filetype on " required!
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"------------------------------------------------------------
" Include Vundle bundles
"------------------------------------------------------------
" Utility sorta things
"
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-surround'
" UI Additions
"
" Show indent levels as background changes
Plugin 'nathanaelkane/vim-indent-guides'
" Better file/directory browsing
Plugin 'scrooloose/nerdtree'
" Easier commenting
Plugin 'scrooloose/nerdcommenter'
" IDE-ish syntax checking
" Plugin 'scrooloose/syntastic'
" Better status bar
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Show live git diff markers
" Plugin 'airblade/vim-gitgutter'
" Alignment
Plugin 'junegunn/vim-easy-align'
" Task list
" Plugin 'superjudge/tasklist-pathogen'
" Language support
"
Plugin 'Markdown'
Plugin 'chase/vim-ansible-yaml'
Plugin 'mustache/vim-mustache-handlebars'
:let vim_scala = $VIM_SCALA
if vim_scala == '1'
Plugin 'derekwyatt/vim-scala'
endif
:let vim_puppet = $VIM_PUPPET
if vim_puppet == '1'
Plugin 'rodjek/vim-puppet'
endif
:let vim_ruby = $VIM_RUBY
if vim_ruby == '1'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rake'
endif
" Tag support
" Plugin 'majutsushi/tagbar'
" A few other random tools
"
" The Silver Surfer integration for faster searching of code
Plugin 'rking/ag.vim'
" fasd integration and a required lib for it
Plugin 'tomtom/tlib_vim'
Plugin 'amiorin/vim-fasd'
"------------------------------------------------------------
" Customize the look of vim
"------------------------------------------------------------
" Default size
if has("gui_running")
set lines=80
set columns=140
endif
" https://github.com/tpope/vim-vividchalk
Plugin 'vividchalk.vim'
" https://github.com/nanotech/jellybeans.vim
Plugin 'nanotech/jellybeans.vim'
" Do syntax highlighting
syntax on
" automatically show matching (, { or [ after matching one is typed
set showmatch
" Spell check by default
" set spell
if has("gui_macvim")
" set macvim specific stuff
silent! set transparency=15
endif
"------------------------------------------------------------
" Other tweaks for how I like things
"------------------------------------------------------------
" Airline status bar config
" Light theme for good contrast
let g:airline_theme='light'
let g:airline#extensions#branch#enabled = 1
" number of spaces to automatically indent
set sw=2
set shiftwidth=2
set softtabstop=2
set tabstop=2
" disable automatic text wrapping
" set nowrap " but still wrap long lines for display
set textwidth=0
set wrapmargin=0
" Use spaces instead of tabs
set expandtab
" ignore case while searching.
set ignorecase
" Force file format to always be unix. If it's allowed to auto-detect
" it will hide all the ^M's because it will think it's a dos file
set fileformats=unix,dos
"set fileformats=unix
" When more than one filename matches during completion, list all
" matches and complete up until the longest common string (like the shell).
set wildmode=list:longest
" Don't autoindent pasted text
set paste
" From https://github.com/seekshreyas/dotfiles/blob/master/.vimrc
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Set the <leader> key to be , instead of \
let mapleader = ","
" Goodbye error bell
set vb t_vb=
"------------------------------------------------------------
" A few plugin specific configs
silent! let g:indent_guides_enable_on_vim_startup = 1 " Enable vim-indent-guides by default
set laststatus=2 " Enable vim-airline by default
" Sql formatting mods for SQLUtilities
" Disable aligning the = in where clauses
let g:sqlutil_align_where = 0
vmap <silent>!sf <Plug>SQLUFormatter<CR>
nmap <silent>!scl <Plug>SQLUCreateColumnList<CR>
nmap <silent>!scd <Plug>SQLUGetColumnDef<CR>
nmap <silent>!scdt <Plug>SQLUGetColumnDataType<CR>
nmap <silent>!scp <Plug>SQLUCreateProcedure<CR>
map <C-n> :NERDTreeToggle<CR>
map <C-s> :set spell!<CR>
map <C-t> :TagbarToggle<CR>
" Fancy tab auto-complete
function! Smart_TabComplete()
let line = getline('.') " current line
let substr = strpart(line, -1, col('.')+1) " from the start of the current
" line to one character right
" of the cursor
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return "\<tab>"
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return "\<C-X>\<C-P>" " existing text matching
elseif ( has_slash )
return "\<C-X>\<C-F>" " file matching
else
return "\<C-X>\<C-O>" " plugin matching
endif
endfunction
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
autocmd BufEnter * cd %:p:h
" Special file type mappings
augroup filetypedetect
au BufNewFile,BufRead *.pig set filetype=pig syntax=pig
au BufNewFile,BufRead *.hive set filetype=sql syntax=sql
au BufNewFile,BufRead *.hsql set filetype=sql syntax=sql
au BufNewFile,BufRead *.config set filetype=yaml syntax=yaml
augroup END
" Allow some local customizations of vim
if isdirectory(expand("$HOME/.vimlocal/"))
for rcfile in split(globpath(expand("$HOME/.vimlocal"), "*.vim"), '\n')
execute('source '.rcfile)
endfor
endif
" Required fix for vundle
call vundle#end() " required!
filetype plugin indent on " required!
" For some reason the usual ftplugins folder doesn't work for these settings for python
au FileType python set shiftwidth=2 softtabstop=2 tabstop=2 textwidth=100 textwidth=100 expandtab smarttab
" Color scheme
set background=dark
" These need to go after the vundle end so the plugins are really loaded
" Fallback if the vundle ones aren't there yet
colorscheme darkblue
" silent! colorscheme vividchalk
silent! colorscheme jellybeans