-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
320 lines (252 loc) · 9.31 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
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
if 0 | endif
if &compatible
set nocompatible " Be iMproved
endif
set runtimepath+=~/.vim/bundle/neobundle.vim/
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'JamshedVesuna/vim-markdown-preview'
NeoBundle 'kopischke/vim-stay'
NeoBundle 'jlanzarotta/bufexplorer'
" RSpec
NeoBundle 'thoughtbot/vim-rspec'
" Formatter
NeoBundle 'Chiel92/vim-autoformat'
" Vim ident guides
NeoBundle 'nathanaelkane/vim-indent-guides'
" Xkb switch
NeoBundle 'lyokha/vim-xkbswitch'
" Hybrid theme
" NeoBundle 'w0ng/vim-hybrid'
" NeoBundle 'kristijanhusak/vim-hybrid-material'
" Whitespaces
NeoBundle 'ntpeters/vim-better-whitespace'
" VIM lightline
NeoBundle 'itchyny/lightline.vim'
" Ctags
NeoBundle 'szw/vim-tags'
" TMUX support
NeoBundle 'jpalardy/vim-slime'
NeoBundle 'jgdavey/tslime.vim'
NeoBundle 'edkolev/tmuxline.vim'
" Search
NeoBundle 'junegunn/fzf'
NeoBundle 'junegunn/fzf.vim'
" NERDTree file browser
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'Xuyuanp/nerdtree-git-plugin'
NeoBundle 'jistr/vim-nerdtree-tabs'
" NERDCommenter
NeoBundle 'scrooloose/nerdcommenter'
" Editorconfig
NeoBundle 'editorconfig/editorconfig-vim'
" Syntax analyze ( so slow )
NeoBundle 'scrooloose/syntastic'
" Languages support
" Scala
NeoBundle 'derekwyatt/vim-scala'
" HOCON
NeoBundle 'GEverding/vim-hocon'
" Ruby
NeoBundle 'vim-ruby/vim-ruby'
NeoBundle 'tpope/vim-rails'
" Crystal
NeoBundle 'rhysd/vim-crystal'
" Go
NeoBundle 'fatih/vim-go'
" js
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'isRuslan/vim-es6'
" Coffee
NeoBundle 'kchmck/vim-coffee-script'
" Babel
NeoBundle 'jbgutierrez/vim-babel'
NeoBundle 'mattn/webapi-vim'
" Mustache, handlebars
NeoBundle 'mustache/vim-mustache-handlebars'
" SLIM
NeoBundle 'onemanstartup/vim-slim'
" Elixir
NeoBundle 'elixir-lang/vim-elixir'
NeoBundle 'awetzel/neovim-elixir'
" Jade
NeoBundle 'digitaltoad/vim-jade'
" Haskell
NeoBundle 'neovimhaskell/haskell-vim'
" Stylus
NeoBundle 'wavded/vim-stylus'
" Fun
NeoBundle 'wakatime/vim-wakatime'
NeoBundle 'easymotion/vim-easymotion'
NeoBundle 'Bugagazavr/dasht.vim'
NeoBundle 'anyakichi/vim-surround'
call neobundle#end()
filetype plugin indent on
NeoBundleCheck
set term=screen-256color
set background=dark
colorscheme Tomorrow-Night
syntax on
" set up some custom colors
highlight clear SignColumn
highlight VertSplit ctermbg=236
highlight ColorColumn ctermbg=237
highlight LineNr ctermbg=236 ctermfg=240
highlight CursorLineNr ctermbg=236 ctermfg=240
highlight CursorLine ctermbg=236
highlight StatusLineNC ctermbg=238 ctermfg=0
highlight StatusLine ctermbg=240 ctermfg=12
highlight IncSearch ctermbg=3 ctermfg=1
highlight Search ctermbg=1 ctermfg=3
highlight Visual ctermbg=3 ctermfg=0
highlight Pmenu ctermbg=240 ctermfg=12
highlight PmenuSel ctermbg=3 ctermfg=1
highlight SpellBad ctermbg=0 ctermfg=1
set tags=.git/tags
set dictionary=/usr/share/dict/words
set langmenu=en_US.UTF-8
set encoding=utf-8
set fileencoding=utf-8
set number
set clipboard=unnamed
set showmatch
set hlsearch
set cursorline
set smartcase
set incsearch
set ttimeoutlen=100
set vb
set ruler
set scrolloff=2
set laststatus=2
" set list listchars=tab:»·,trail:·
set viewoptions=cursor,folds,slash,unix
set tw=80
set wildmode=longest,full
set wildmenu
" put git status, column/row number, total lines, and percentage in status
" set statusline=%F%m%r%h%w\ %{fugitive#statusline()}\ [%l,%c]\ [%L,%p%%]
" set statusline=%{fugitive#statusline()}
" highlight the status bar when in insert mode
if version >= 700
au InsertEnter * hi StatusLine ctermfg=235 ctermbg=2
au InsertLeave * hi StatusLine ctermbg=240 ctermfg=12
endif
" highlight trailing spaces in annoying red
highlight ExtraWhitespace ctermbg=1 guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" Disable tmp files
set nobackup
set nowb
set noswapfile
" fix delete
set backspace=indent,eol,start
if executable('zsh')
set shell=zsh
endif
" Whitespace removals
autocmd BufWritePre * StripWhitespace
" NERDTree
" let g:nerdtree_tabs_open_on_console_startup = 1
let g:nerdtree_tabs_focus_on_files = 1
" Hide usls files
let NERDTreeIgnore = ['\.pyc$', '\.tags$', 'tags$', 'tags.lock$', '\.jar$', '^\.bzr$', '^\.hg$', '^\.git$', '\.swp$', '^\.svn', '^\.DS_Store$']
" Show hidden items
let NERDTreeShowHidden = 1
" Ctags
let g:vim_tags_directories = [".git", ".hg", ".svn", ".bzr"]
let g:vim_tags_gems_tags_command = "{CTAGS} -R {OPTIONS} `bundle show --paths` 2>/dev/null"
let g:vim_tags_auto_generate = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:dasht_context = { 'ruby': ['Ruby_2', 'Ruby_on_Rails_4'] }
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
imap <expr> <c-x><c-f> fzf#vim#complete#path('git ls-files $(git rev-parse --show-toplevel)')
function! s:fzf_root()
let path = finddir(".git", expand("%:p:h").";")
return fnamemodify(substitute(path, ".git", "", ""), ":p:h")
endfunction
" " Indent guides settings
let g:indent_guides_auto_colors = 0
let indent_guides_color_change_percent = 10
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#212121 ctermbg=235
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#404040 ctermbg=237
autocmd VimEnter * :IndentGuidesToggle
"
" Ruby settings
let g:ruby_path = system('rvm current')
let g:ruby_indent_access_modifier_style = 'outdent'
let ruby_operators = 1
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
" Tmux support
let g:slime_target = 'tmux'
let g:slime_paste_file = "$HOME/.slime_paste"
let g:slime_paste_file = tempname()
let g:slime_default_config = {"socket_name": "default", "target_pane": "1"}
" Git support
autocmd Filetype gitcommit setlocal spell textwidth=72
" Indentetion settings
autocmd Filetype html setlocal ts=2 sw=2 expandtab
autocmd Filetype yaml setlocal ts=2 sw=2 expandtab
autocmd Filetype scala setlocal ts=2 sw=2 expandtab
autocmd Filetype java setlocal ts=2 sw=2 expandtab
autocmd Filetype python setlocal ts=4 sw=4 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype eruby setlocal ts=2 sw=2 expandtab
autocmd Filetype stylus setlocal ts=2 sw=2 expandtab
autocmd Filetype vim setlocal ts=2 sw=2 expandtab
autocmd Filetype json setlocal ts=2 sw=2 expandtab
autocmd Filetype slim setlocal ts=2 sw=2 expandtab
autocmd Filetype jade setlocal ts=2 sw=2 expandtab
autocmd Filetype sass setlocal ts=2 sw=2 expandtab
autocmd Filetype css setlocal ts=2 sw=2 expandtab
autocmd Filetype mustache setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
autocmd Filetype coffeescript setlocal ts=2 sw=2 expandtab
autocmd Filetype crystal setlocal ts=2 sw=2 expandtab
autocmd Filetype cucumber setlocal ts=2 sw=2 expandtab
let mapleader=","
nmap <Leader>k :DashtContext <C-R><C-W><CR>
nmap <Leader>af :Autoformat<CR>
nmap <Leader>n :NERDTreeToggle<CR>
nmap <Leader>tn :tabnew<CR>
nmap <Leader>th :tabp<CR>
nmap <Leader>tl :tabn<CR>
nmap <Leader>f :FZF<CR>
nmap <Leader>s :SyntasticCheck<CR>
nmap <Leader>b :Gblame<CR>
nmap <Leader>d :Gdiff<CR>
map <Leader>rt :call RunCurrentSpecFile()<CR>
map <Leader>rs :call RunNearestSpec()<CR>
map <Leader>rl :call RunLastSpec()<CR>
map <Leader>ra :call RunAllSpecs()<CR>
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('slim', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('rb', 'Magenta', 'none', '#ff00ff', '#151515')