-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvimrc
More file actions
286 lines (241 loc) · 7.64 KB
/
vimrc
File metadata and controls
286 lines (241 loc) · 7.64 KB
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
""""""""""""""""""""""""""""""""""""""""
" Init Vundle
""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
if finddir('~/.vim/bundle/Vundle.vim') != ""
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
set regexpengine=1 " fix performance issues in Ruby
set shell=/bin/bash
endif
""""""""""""""""""""""""""""""""""""""""
" Plugins
""""""""""""""""""""""""""""""""""""""""
if exists(':Plugin')
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-ragtag'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-eunuch'
Plugin 'tpope/vim-sleuth'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-fireplace'
Plugin 'tpope/vim-vinegar'
Plugin 'tpope/vim-projectionist'
Plugin 'tpope/vim-leiningen'
Plugin 'tpope/vim-rhubarb'
Plugin 'tpope/vim-scriptease'
Plugin 'tpope/vim-tbone'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'gregsexton/gitv'
Plugin 'guns/vim-sexp'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'guns/xterm-color-table.vim'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'davidhalter/jedi-vim'
Plugin 'fatih/vim-go'
Plugin 'mattn/emmet-vim'
Plugin 'JuliaLang/julia-vim'
Plugin 'wting/rust.vim'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'hashivim/vim-terraform'
Plugin 'will133/vim-dirdiff'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'HerringtonDarkholme/yats.vim'
Plugin 'Quramy/tsuquyomi'
Plugin 'andreshazard/vim-freemarker'
" Own plugins
Plugin 'gyim/vim-boxdraw'
call vundle#end()
endif
filetype plugin indent on
""""""""""""""""""""""""""""""""""""""""
" General settings
""""""""""""""""""""""""""""""""""""""""
set wildignore=*.o,*.a,*.swp,*.egg-info,*.pyc,*.class,Session.vim
set noswapfile nobackup
set noeol binary "do not leave an empty line at the end of file"
set encoding=utf-8
set previewheight=20
set ignorecase smartcase
set fileformats=unix,dos,mac
set hidden visualbell
set linebreak
set hlsearch
set splitright
set wildmode=full wildmenu
set cryptmethod=blowfish2
set updatetime=1000
let g:auto_save=0
let g:netrw_liststyle=0
let g:netrw_preview = 1
let g:jsx_ext_required = 0
""""""""""""""""""""""""""""""""""""""""
" Editing
""""""""""""""""""""""""""""""""""""""""
set sw=4 ts=4 sts=4
set nowrap breakindent
set tags=./tags;$HOME
set diffopt=filler
""""""""""""""""""""""""""""""""""""""""
" GUI settings
""""""""""""""""""""""""""""""""""""""""
syntax on
set guifont=Monaco:h12
set noantialias
set number
set relativenumber
set mouse=a ttymouse=sgr
nnoremap <A-LeftMouse> <LeftMouse><C-V>
set colorcolumn=80
silent! colorscheme tomorrow_night_bright
""""""""""""""""""""""""""""""""""""""""
" Key mappings
""""""""""""""""""""""""""""""""""""""""
" Commands
nnoremap <leader>U :execute "Ggrep '" . expand("<cword>") . "'" <CR>
nnoremap <silent> <leader>n :noh<CR>:pc<CR>:ccl<CR>:lclose<CR>
nnoremap <silent> <leader>m *<C-o>
nnoremap <silent> <C-w><C-t> :tab split<CR>
nnoremap <silent> <leader>\ :Commentary<CR>
vnoremap <silent> <leader>\ :Commentary<CR>
" FZF mappings
nnoremap <leader>r :execute "Rg " . expand("<cword>") . "" <CR>
nnoremap <leader>b :execute "Buffers"<CR>
nnoremap <leader>f :execute "Files"<CR>
nnoremap <leader>C :execute "Commits"<CR>
let g:fzf_layout = { 'down': 30 }
" Clipboard
nnoremap <leader>c "+y
nnoremap <leader>v "+p
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>c "+y
vnoremap <leader>v "+p
vnoremap <leader>p "+p
vnoremap <leader>P "+P
" EasyMotion
let g:EasyMotion_do_mapping = 0
nmap <Space> <Plug>(easymotion-overwin-w)
" Buffer management
nnoremap [a :prev<CR>:args<CR>
nnoremap ]a :next<CR>:args<CR>
nnoremap <leader>d :bd<CR>
" Clojure
nnoremap <silent><leader>sl :w<CR>:Slamhound<CR>
nnoremap <silent>cpR :w<CR>:Require<CR>
nnoremap <silent>cpo :w<CR>:Eval<CR>
let g:leiningen_no_auto_repl=1
" Go
nnoremap <leader>gt :w<CR>:GoTestFunc<CR>
nnoremap <leader>gT :w<CR>:GoTest<CR>
nnoremap <leader>gb :w<CR>:GoBuild<CR>
nnoremap <leader>gi :w<CR>:GoInstall<CR>
nnoremap <leader>gg :GoImplements<CR>:lfirst<CR>
" Terraform
nnoremap <leader>T :TerraformFmt<CR>:w<CR>
""""""""""""""""""""""""""""""""""""""""
" Fold settings
""""""""""""""""""""""""""""""""""""""""
set foldmethod=syntax foldnestmax=1 nofoldenable
fu! CustomFoldText()
"get first non-blank line
let fs = v:foldstart
while getline(fs) =~ '^\s*$' | let fs = nextnonblank(fs + 1)
endwhile
if fs > v:foldend
let line = getline(v:foldstart)
else
let line = substitute(getline(fs), '\t', repeat(' ', &tabstop), 'g')
endif
let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0)
let foldSize = 1 + v:foldend - v:foldstart
let foldSizeStr = " [" . foldSize . " lines] "
let foldLevelStr = repeat("+--", v:foldlevel)
let lineCount = line("$")
let expansionString = repeat(" ", w - strwidth(foldSizeStr.line.foldLevelStr))
return line . expansionString . foldSizeStr . foldLevelStr
endf
set foldtext=CustomFoldText()
""""""""""""""""""""""""""""""""""""""""
" Plugin settings
""""""""""""""""""""""""""""""""""""""""
" Ctrl-P
let g:ctrlp_working_path_mode = 0
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$\|build/.*$\|doc/.*$'
" Fugitive
autocmd BufNewFile,BufRead fugitive://* set bufhidden=delete
" FZF (uncomment for old Linux kernels)
"let g:fzf_preview_window = ''
" jedi-vim
let g:jedi#goto_command = "<leader>g"
let g:jedi#goto_assignments_command = "<leader>a"
let g:jedi#goto_stubs_command = "<leader>s"
let g:jedi#goto_definitions_command = "<leader>G"
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>u"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>R"
" Netrw workaround
autocmd FileType netrw setl bufhidden=delete
""""""""""""""""""""""""""""""""""""""""
" Language-specific settings
""""""""""""""""""""""""""""""""""""""""
" Mail
au FileType mail setl formatoptions+=aw wrap
" C/C++/Objective
au FileType c,objc,cpp setl noexpandtab
au FileType c,objc,cpp setl commentstring=//%s
" Python
au FileType python setl expandtab
iabbrev pybang #!/usr/bin/env python
iabbrev pybang3 #!/usr/bin/env python
iabbrev ifmain if __name__ == '__main__':<CR> main()
" Ruby
au FileType ruby setl expandtab sw=2 ts=2 sts=2
au FileType ruby setl foldmethod=manual " fix performance issues
au BufRead,BufNewFile Vagrantfile* set filetype=ruby
" HTML / PHP
au FileType xml,html,php setl smartindent nocindent
au FileType php setl keywordprg=pman
" JavaScript
au BufRead,BufNewFile *.jsm setl filetype=javascript
au FileType javascript setl expandtab sw=2 ts=2 sts=2
" TypeScript
au FileType typescript setl foldmethod=manual
" Markdown
au BufRead,BufNewFile *.md setl filetype=markdown
" AsciiDoc
au BufRead,BufNewFile *.adoc setl filetype=asciidoc
" Clojure
if exists(':RainbowParenthesesToggle')
au VimEnter * RainbowParenthesesToggle
au Syntax clojure RainbowParenthesesLoadRound
au Syntax clojure RainbowParenthesesLoadSquare
au Syntax clojure RainbowParenthesesLoadBraces
endif
au FileType clojure set lispwords+=ns,fact,facts,into,for,doseq,when-let,when-some,when-not,if-let,for,doseq,fn,go,go-loop,while,loop,catch,binding,try,reify,condp,locking,doto,testing,local-job,remote-job,extend-protocol
au FileType clojure set lispwords-=do
au BufRead,BufNewFile *.pxi set filetype=clojure
" LLVM
au BufRead,BufNewFile *.ll setl filetype=llvm smartindent
" Shell script
iabbrev shbang #!/bin/bash
""""""""""""""""""""""""""""""""""""""""
" Other
""""""""""""""""""""""""""""""""""""""""
filetype plugin indent on "required for Vundle
if filereadable($HOME . "/.vimrc.secret")
source $HOME/.vimrc.secret
endif