This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
vimrc
292 lines (255 loc) Β· 8.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
set nocompatible
runtime macros/matchit.vim
filetype indent plugin on
set is
set encoding=utf-8
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
let g:ackprg = 'ag --nogroup --nocolor --column'
" ========== autocomplete
Plugin 'styled-components/vim-styled-components'
Plugin 'mattn/emmet-vim'
Plugin 'ervandew/supertab'
Plugin 'valloric/youcompleteme'
Plugin 'luochen1990/rainbow'
let g:rainbow_active = 1 "0
let mapleader = ","
" ========= snippets
Plugin 'honza/vim-snippets'
Plugin 'SirVer/ultisnips'
Plugin 'Yggdroot/indentLine'
Plugin 'mhinz/vim-startify'
let g:indentLine_char = '.'
Plugin 'epilande/vim-es2015-snippets'
Plugin 'epilande/vim-react-snippets'
Plugin 'easymotion/vim-easymotion'
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>'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<Tab>"
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-Tab>"
" ========== ruby plugins
Plugin 'tpope/vim-dispatch'
Plugin 'jgdavey/tslime.vim'
Plugin 'nelstrom/vim-textobj-rubyblock'
Plugin 'kana/vim-textobj-user'
"let g:rspec_command = 'call Send_to_Tmux("rspec {spec}\n")'
let g:rspec_command = "Dispatch rspec {spec}"
map <Leader>vp :VimuxPromptCommand<CR>
map <Leader>vl :VimuxRunLastCommand<CR>
map <Leader>vz :VimuxZoomRunner<CR>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set splitbelow
set splitright
Plugin 'leafgarland/typescript-vim'
Plugin 'mxw/vim-jsx'
Plugin 'pangloss/vim-javascript'
Plugin 'w0rp/ale'
let g:ale_linters = {
\ 'python': ['flake8', 'pylint'],
\ 'javascript': ['eslint'],
\ 'vue': ['eslint']
\
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'vue': ['eslint'],
\ 'scss': ['prettier']
\
\}
" set up ascii for my startify
let g:startify_custom_header = [
\ '________ .__ .__ _________.__',
\ '\______ \ _____ ____ |__| ____ | | / _____/| |__ ______ _ __',
\ ' | | \\__ \ / \| |/ __ \| | \_____ \ | | \ / _ \ \/ \/ /',
\ ' | ` \/ __ \| | \ \ ___/| |__ / \| Y ( <_> )/ `',
\ '/_______ (____ /___| /__|\___ >____/ /_______ /|___| /\____/\/\_/)',
\ ' \/ \/ \/ \/ \/ \/',
\ ]
let g:ale_fix_on_save = 1
let g:jsx_ext_required = 1
let g:jsx_pragma_required = 1
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
let g:typescript_ignore_browserwords = 1
let g:typescript_ignore_typescriptdoc = 1
" vim-rspec mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" ========== colorschemes
Plugin 'flazz/vim-colorschemes'
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'craigemery/vim-autotag'
Plugin 'edkolev/tmuxline.vim'
Plugin 'michaeljsmith/vim-indent-object'
" =========== git
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'jparise/vim-graphql'
Plugin 'vim-syntastic/syntastic'
" ==== enable matchit
" =========== markdown
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'dyng/ctrlsf.vim' " for really nice search results like in sublime
Plugin 'yonchu/accelerated-smooth-scroll'
Plugin 'vim-scripts/IndexedSearch'
Plugin 'itspriddle/vim-jquery'
Plugin 'tpope/vim-haml'
Plugin 'junegunn/goyo.vim'
Plugin 'ecomba/vim-ruby-refactoring'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-bundler'
"========= syntax helpers
Plugin 'hail2u/vim-css3-syntax'
Plugin 'ap/vim-css-color'
Plugin 'tpope/vim-commentary'
Plugin 'junegunn/fzf.vim'
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plugin 'Chiel92/vim-autoformat'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'jiangmiao/auto-pairs'
Plugin 'lambdalisue/vim-django-support'
Plugin 'alvan/vim-closetag'
let g:closetag_filenames = '*.html,*.xhtml,*.xml,*.vue,*.php,*.phtml,*.js,*.jsx,*.coffee,*.erb'
"======= eslint
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exe = 'npm run lint --'
let g:syntastic_ruby_checkers = ['rubocop']
" ========= file tree
Plugin 'scrooloose/nerdtree'
let NERDTreeIgnore = [ '__pycache__', '\.pyc$', '\.o$', '\.swp', '*\.swp', 'node_modules/' ]
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=1
" ========= rails
Plugin 'kchmck/vim-coffee-script'
Plugin 'thoughtbot/vim-rspec'
Plugin 'tpope/vim-rails'
Plugin 'ngmy/vim-rubocop'
" ========= navigation
Plugin 'christoomey/vim-tmux-navigator'
" autostart nerd-tree
autocmd StdinReadPre * let s:std_in=1
" nerdtree toggle
map <C-t> :NERDTreeToggle<CR>
Plugin 'zhaocai/GoldenView.Vim'
let g:goldenview__enable_default_mapping = 0
Plugin 'benmills/vimux'
" vimux binding
map <Leader>vp :VimuxPromptCommand<CR>
nmap <F8> :TagbarToggle<CR>
" ======= fuzzy find
" Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-eunuch'
" ======= extras
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'majutsushi/tagbar'
Plugin 'wincent/command-t'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'mileszs/ack.vim'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" let g:airline_left_sep = 'Β»'
" let g:airline_left_sep = 'βΆ'
" let g:airline_right_sep = 'Β«'
" let g:airline_right_sep = 'β'
" let g:airline_symbols.crypt = 'π'
" let g:airline_symbols.linenr = 'β°'
" let g:airline_symbols.linenr = 'β'
" let g:airline_symbols.linenr = 'β€'
" let g:airline_symbols.linenr = 'ΒΆ'
" let g:airline_symbols.maxlinenr = ''
" let g:airline_symbols.maxlinenr = 'γ'
" let g:airline_symbols.branch = 'β'
" let g:airline_symbols.paste = 'Ο'
" let g:airline_symbols.paste = 'Γ'
" let g:airline_symbols.paste = 'β₯'
" let g:airline_symbols.spell = 'κ¨'
" let g:airline_symbols.notexists = 'Ι'
" let g:airline_symbols.whitespace = 'Ξ'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
call vundle#end() " required
filetype plugin indent on " required
" ============= extra settings
syntax on
" tabs to 2 spaces
" set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
set ruler
set hidden
:set guioptions-=m " remove menu bar
:set guioptions-=T " remove toolbar
:set guioptions-=r " remove right-hand scroll bar
:set guioptions-=L " remove left-hand scroll bar
":set lines=999 columns=999
set shortmess+=A " disable swap file warning
" hybrid line numbers
set number relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" colorschemes
" Dark: monokai-chris, gruvbox
" Light: ChocolatePapaya
Plugin 'morhetz/gruvbox'
colorscheme gruvbox
let g:gruvbox_contrast_dark='default'
let g:gruvbox_contrast_light='default'
" split below and right feels more natural
set splitbelow
set background=dark
" no wrapping
set nowrap
" allow backspace immediately after insert
set bs=2
" useful aliases
cnoreabbrev W w
cnoreabbrev Q q
" save undo in a file
set undofile
set undodir=~/.vim/undo
set undolevels=1000
set undoreload=10000
" tmux will only forward escape sequences to the terminal if surrounded by a
" DCS sequence
" "
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Folding
augroup XML
autocmd!
autocmd FileType xml setlocal foldmethod=indent foldlevelstart=999 foldminlines=0
augroup END
map ; :Files<CR>