-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
245 lines (205 loc) · 6.46 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
set nocompatible " Required
filetype off
set textwidth=78
set formatoptions=1
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Core
Plugin 'flazz/vim-colorschemes'
Plugin 'gmarik/Vundle.vim'
" Plugin 'Lokaltog/powerline'
Plugin 'bling/vim-airline'
Plugin 'mileszs/ack.vim'
Plugin 'tpope/vim-dispatch'
" Plugin 'benmills/vimux' "just like vim-dispatch but tied to tmux
"Editing tweaks
" Plugin 'drmingdrmer/xptemplate'
" Plugin 'paradigm/vim-multicursor'
" Note: aws-cfn-snippet relies on neocomplete
Plugin 'Shougo/neocomplete.vim'
Plugin 'lunarxlark/aws-cfn-snippet.vim'
" Plugin 'Valloric/YouCompleteMe'
" Plugin 'SirVer/ultisnips'
Plugin 'godlygeek/tabular'
Plugin 'mattn/emmet-vim'
Plugin 'hrj/vim-DrawIt'
"Project
Plugin 'scrooloose/nerdtree'
Plugin 'rizzatti/funcoo.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'rizzatti/dash.vim'
" Plugin 'wincent/Command-T'
" Plugin 'jgdavey/vim-turbux' "Commenting out since this maps <Leader>t in
" non-ruby files
"Source control
Plugin 'tpope/vim-fugitive'
nnoremap <buffer> <silent> cP :exec 'Gpedit '.expand('<cword>')<CR><C-W>H
if has( "autocmd" )
au BufReadPost fugitive://* set bufhidden=delete
endif
Plugin 'airblade/vim-gitgutter'
let g:gitgutter_max_signs = 1000
"use this with airline?
let g:airline#extensions#branch#enabled = 1
"Multi-language (programming languages)
Plugin 'scrooloose/syntastic'
Plugin 'honza/vim-snippets' "These are just snippets for ultisnips. no other purpose
" Plugin 'tomtom/tcomment_vim'
"Cloud and automation
Plugin 'hashivim/vim-terraform'
"JS
"NOTE! Tern requires that you call 'npm install' inside its Plugin dir
Plugin 'marijnh/tern_for_vim'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'kchmck/vim-coffee-script'
Plugin 'mtscout6/vim-cjsx'
"CPP and Go
" TODO: find a non-crappy go plugin. All of them fail in ways that make me
" ragequit to sublime on a regular basis.
" Plugin 'Rip-Rip/clang_complete'
" Plugin 'Blackrush/vim-gocode'
Plugin 'fatih/vim-go'
" Plugin 'nsf/gocode', {'rtp': 'vim/'}
" CSharp
"Plugin 'OmniSharp/Omnisharp-vim'
"let g:OmniSharp_selector_ui = 'ctrlp'
"Clojure
" Plugin 'vim-scripts/foldsearch'
" Plugin 'tpope/vim-classpath'
" Plugin 'tpope/vim-fireplace'
" Plugin 'guns/vim-clojure-static'
" Plugin 'kien/rainbow_parentheses.vim'
" Plugin 'vim-scripts/paredit.vim'
" Rust
Plugin 'rust-lang/rust.vim'
" let g:rustfmt_autosave = 1 " doesn't work!
"""""""""""""""""""""""""End Plugins
call vundle#end() " required
filetype plugin indent on " required
"colorscheme Monokai
"colorscheme lily "good for .Net at times
colorscheme grb256
let g:clojure_align_multiline_strings = 1
syntax on
let g:syntastic_javascript_checkers = ['eslint']
set backspace=indent,eol,start " make backspace a more flexible
set ruler
set co=120
set scrolloff=3
set history=200
set ignorecase "thas right... no case
let baan_fold=1
set foldmethod=indent "fold based on indent
set foldnestmax=5 "deepest fold is 10 levels
set foldminlines=3
"set nofoldenable "dont fold by default
"set foldmethod=marker " Fold on the marker
set foldlevel=2 " Don't autofold anything (but I can still fold manually)
set foldopen=block,hor,mark,percent,quickfix,tag " what movements open folds
function! SimpleFoldText()
return getline(v:foldstart).' '
endfunction
"set foldtext=SimpleFoldText() " Custom fold text function (cleaner than default)
set nowrap
set sts=4
set ts=4
set sw=4
set et
set fen
set ai
set si
set cin
let g:multicursor_quit = "<Esc>"
"
"attempt to fix up multi-cursor. This map fails so I'm commenting out till I
"have time to fix it:
"xnoremap <Leader>` "*y<Esc>:call MultiCursorSearch('<c-r>=substitute(escape(@*, '\/.*$^~[]'), "\n", '\\n', "g")<cr>')<cr>
"""""""""""""""""""""""""""""""""""""
"from github nvie/vimrc
" make p in Visual mode replace the selected text with the yank register
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
" End of yanking from nvie/vimrc """"""""""""""""""""""""""""""""""""
fun! ScratchMarkBuffer()
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal buflisted
endfun
if has( "autocmd" )
au! BufRead,BufEnter,BufNewFile Dockerfile.* setlocal ft=Dockerfile
au FileType go setlocal nocindent
au FileType md setlocal nocindent
au FileType rb setlocal ts=2 sts=2 sw=2 et
au FileType ruby setlocal ts=2 sts=2 sw=2 et
au FileType sh setlocal ts=2 sts=2 sw=2 et
au FileType yaml setlocal ts=2 sts=2 sw=2 et
au FileType sls setlocal ts=2 sts=2 sw=2 et
au FileType tf setlocal ts=2 sts=2 sw=2 et
au FileType yml setlocal ts=2 sts=2 sw=2 et
au FileType coffee setlocal ts=2 sts=2 sw=2 et
au FileType jade setlocal ts=2 sts=2 sw=2 et
au FileType clojure RainbowParenthesesLoadRound
endif
fun! ToggleNERDTree() "{{{
if !exists("t:toggleNerdTree")
let t:toggleNerdTree = 0
endif
if t:toggleNerdTree
NERDTreeClose
let t:toggleNerdTree = 0
else
NERDTree
let t:toggleNerdTree = 1
endif
endfunction "}}}
map <Leader>n :call ToggleNERDTree()<CR>
let NERDTreeIgnore = ['\.pyc$']
map <Leader>t :GoTest<CR>
nnoremap ]q :cnext<cr>
nnoremap [q :cprevious<cr>
nnoremap ,, <C-^>
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,latin1
endif
""""""""""""""""""""""""""""""""""""""""""""""""""
""Airline conf
""""""""""""""""""""""""""""""""""""""""""""""""""
" let g:airline_left_sep = '»'
" let g:airline_left_sep = '▶'
" let g:airline_right_sep = '«'
" let g:airline_right_sep = '◀'
" let g:airline_symbols.linenr = '␊'
" let g:airline_symbols.linenr = ''
" let g:airline_symbols.linenr = '¶'
" let g:airline_symbols.branch = '⎇'
" let g:airline_symbols.paste = 'ρ'
" let g:airline_symbols.paste = 'Þ'
" let g:airline_symbols.paste = '∥'
" let g:airline_symbols.whitespace = 'Ξ'
let g:UltiSnipsExpandTrigger="<c-j>"
set laststatus=2 nu hidden
let g:airline_powerline_fonts=1
set guifont=Meslo\ LG\ S\ DZ\ Regular\ for\ Powerline:h12
set diffopt=iwhite,vertical
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
function! s:DiffWithSaved()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfunction
com! DiffSaved call s:DiffWithSaved()