-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
214 lines (189 loc) · 5.98 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
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'ConradIrwin/vim-bracketed-paste'
Plugin 'Galooshi/vim-import-js'
Plugin 'Glench/Vim-Jinja2-Syntax'
Plugin 'HerringtonDarkholme/yats.vim'
Plugin 'SirVer/ultisnips'
Plugin 'airblade/vim-gitgutter'
Plugin 'altercation/vim-colors-solarized'
Plugin 'b4b4r07/vim-hcl'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'ervandew/supertab'
Plugin 'fatih/vim-go'
Plugin 'godlygeek/tabular'
Plugin 'groenewege/vim-less'
Plugin 'jaawerth/nrun.vim'
Plugin 'jisaacks/GitGutter'
Plugin 'jremmen/vim-ripgrep'
Plugin 'majutsushi/tagbar'
Plugin 'mileszs/ack.vim'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'pangloss/vim-javascript'
Plugin 'peitalin/vim-jsx-typescript'
Plugin 'plasticboy/vim-markdown'
Plugin 'powerline/powerline'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'solarnz/thrift.vim'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-projectionist'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-rake'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-surround'
Plugin 'vim-ruby/vim-ruby'
Plugin 'w0rp/ale'
Plugin 'wincent/command-t'
Plugin 'wincent/ferret'
Plugin 'wincent/loupe'
Plugin 'wlangstroth/vim-racket'
Plugin 'ycm-core/YouCompleteMe'
" Typescript
Plugin 'Quramy/tsuquyomi'
Plugin 'leafgarland/typescript-vim'
call vundle#end()
filetype plugin indent on
set autoread
set autoindent
set background=dark
set backspace=2
set backupdir=~/.files/vim/tmp//
set breakindent " vim8: indent broken lines to first line's indent level
set breakindentopt=shift:2 " indent broken lines with additional two spaces
set breakindentopt+=sbr " use the 'showbreak' character
set breakindentopt+=min:80 " ensure the wrapped line has a width of 80
set colorcolumn=80
set completeopt-=preview " disable preview window for completion menu selections
set completeopt+=noselect " don't eagerly select first item in autocomplete menu
set dir=~/.files/vim/tmp//
set expandtab
set foldlevelstart=1 " remind myself that folds exist
set foldopen-=block " allow { and } to not open folds
set hlsearch
set incsearch
set laststatus=2
set list
set listchars=tab:>-
set linebreak " line-break at word boundaries
set nocompatible
set number
set regexpengine=1 " (magic?) increase vim responsiveness in iTerm significantly
set relativenumber
set scrolloff=5
set softtabstop=2
set shiftround
set shiftwidth=42
set showtabline=2
set showbreak=>>
set sidescrolloff=3
set sw=2
set swapfile
set switchbuf=useopen " allow re-opening buffer in multiple tabs
set term=xterm-256color
set ts=2
set visualbell t_vb= " disable bell sound and visual bell
set wildmenu
set wildmode=longest,list,full
set wildignore+=*/node_modules/*,*/vendor/*,*/env/*,*/bower_components/*,*.pyc,doc/*,*/tmp/*,target/*,coverage/*
syntax on
colorscheme grb256
highlight ColorColumn ctermbg=234
" customize colors for ALE
highlight ALEError ctermbg=52
highlight ALEWarning ctermbg=58
highlight ALEErrorSign ctermfg=52
highlight ALEWarningSign ctermfg=58
" Highlight extraneous whitespace.
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+\%#\@<!$/
" Tom slop
" Map :Wq, :WQ, :Q, :W to their appropriately-cased counterparts
command W w
command Q q
command WQ wq
command Wq wq
command Wqa wqa
inoremap [:w <Esc>:w
" Improve fold colors
highlight Folded ctermbg=234
" Improve auto-complete menu
" https://vim.fandom.com/wiki/Improve_completion_popup_menu
inoremap <expr> <C-j> pumvisible() ? "\<C-n>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<C-p>" : "\<C-k>"
" The ultimate status line.
set statusline=%F%m%r%h%w\ [TYPE=%Y\ %{&ff}]\ [%l/%L\ (%p%%)]
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
if has('persistent_undo')
set undodir=~/.vim/tmp/undo// " keep undo files out of the way
set undofile " actually use undo files
endif
" For CommandT
let mapleader = ','
let g:CommandTMaxHeight=7
let g:CommandTMatchWindowReverse = 1
let g:CommandTMaxDepth=15
let g:CommandTInputDebounce=100
let g:CommandTFileScanner='find'
" For GitGutter
let g:gitgutter_eager=0
let g:gitgutter_realtime=0
map <Leader>[ :GitGutterPrevHunk<CR>
map <Leader>] :GitGutterNextHunk<CR>
" For vim-go
let g:go_fmt_command = "goimports"
nnoremap <Leader>d :GoDef<CR>
" For NERD Tree
nnoremap <Leader><Leader> :NERDTreeFind<CR>
let NERDTreeIgnore = ['\.pyc$', '__pycache__', 'node_modules']
" For vim-rails
let g:rails_projections = {
\ "app/lib/*.rb": { "spec": "spec/lib/{}_spec.rb" }
\ }
" For ale
let g:ale_completion_enabled = 1
" YouCompleteMe and UltiSnips compatibility, with the helper of supertab
" (via http://stackoverflow.com/a/22253548/1626737)
" https://medium.com/brigade-engineering/sharpen-your-vim-with-snippets-767b693886db
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabCrMapping = 0
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
function GoPreviousTabOrBuffer()
if tabpagenr('$') == 1
exec(":bp")
else
exec(":tabprevious")
endif
endfunction
nnoremap <silent> gT :call GoPreviousTabOrBuffer()<CR>
function GoNextTabOrBuffer()
if tabpagenr('$') == 1
exec(":bn")
else
exec(":tabnext")
endif
endfunction
nnoremap <silent> gt :call GoNextTabOrBuffer()<CR>
nnoremap <Leader>r :redraw!<CR>
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" load ~/dev/config/[project]/vimrc if it exists
function LoadProjectVimConfig()
let l:project_name = trim(system("basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)"))
let l:project_vimscript_file = expand("~/dev/config/" . project_name . "/vimrc")
if filereadable(l:project_vimscript_file)
exec "source " . l:project_vimscript_file
endif
endfunction
call LoadProjectVimConfig()