-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
245 lines (227 loc) · 6.43 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
" basic vim option settings.
set nocompatible
set number
filetype plugin indent on
syntax enable
set background=dark
set backspace=2
set encoding=utf-8
set list
set listchars=tab:»\ ,trail:·,extends:»,precedes:«,nbsp:+
set autoindent
set expandtab
set smarttab
set softtabstop=4
set shiftwidth=4
set shiftround
set textwidth=80
set cursorline
set hlsearch
set incsearch
set showmatch
set history=1000
set undolevels=1000
set tags=tags;/
" Enable matchit.vim
runtime macros/matchit.vim
" vim-plug sections begin
call plug#begin('~/.vim/plugged')
" Build YCM after installed/updated
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status != 'unchanged' || a:info.force
!./install.py
endif
endfunction
" Disable delimitmate during multi-cursor
function! Multiple_cursors_before()
try
let b:saved_delimitMate_statues = b:delimitMate_enabled
silent! execute('imap "')
DelimitMateOff
silent! execute('imap "')
catch
endtry
endfunction
" Restore delimitmate after multi-cursor
function! Multiple_cursors_after()
try
if b:saved_delimitMate_statues
silent! execute('imap "')
silent! DelimitMateOn
silent! execute('imap "')
endif
catch
endtry
endfunction
" solarized color scheme
Plug 'altercation/vim-colors-solarized'
" nerdtreed
Plug 'scrooloose/nerdtree'
" auto completion
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
" ycm generator
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" ALE
Plug 'w0rp/ale'
" surround
Plug 'tpope/vim-surround'
" repeat.vim
Plug 'tpope/vim-repeat'
" PreserveNoEOL
Plug 'vim-scripts/PreserveNoEOL'
" vim status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" git plugins
Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
" tagbar
Plug 'majutsushi/tagbar'
" vim-javascript
Plug 'pangloss/vim-javascript'
" fzf plugin for vim
" Install fzf itself by brew
Plug 'junegunn/fzf.vim'
" delimitmate
Plug 'raimondi/delimitmate'
" commentary.vim
Plug 'tpope/vim-commentary'
" gitgutter
Plug 'airblade/vim-gitgutter'
" closetag.vim
Plug 'docunext/closetag.vim'
" vim-polyglot
Plug 'sheerun/vim-polyglot'
" vim-markdown-preview
Plug 'jamshedvesuna/vim-markdown-preview'
" multi-cursor
Plug 'terryma/vim-multiple-cursors'
" vim-sleuth
" Plug 'tpope/vim-sleuth'
" vim-indent-object
Plug 'michaeljsmith/vim-indent-object'
" vim-plug section end
call plug#end()
" solarized
colo solarized
" shortcuts
" custom leader-map for OS-X
let mapleader = ','
" quick save shortcut
noremap <Leader>s :update<CR>
" quick quit shortcut
noremap <Leader>q :q<CR>
" nerdtree shortcut
map <Leader>n :NERDTreeToggle<CR>
" tagBar shortcut
nmap <F6> :TagbarToggle<CR>
" fzf buffers search shortcut
nmap ; :Buffers<CR>
" fzf files search shortcut
nmap <Leader>t :Files<CR>
" fzf tags search shortcut
nmap <Leader>r :Tags<CR>
" fzf(+ rg) files search shortcut
nmap <C-p> :Rg<CR>
" ALE
" Open error loclist window
let g:ale_open_list = 1
" Don't close ALE window even there are no errors
let g:ale_keep_list_window_open = 1
" Integration with vim-airline
let g:airline#extensions#ale#enabled = 1
" Completion enabled
let g:ale_completion_enabled = 1
" Detect pipenv automatically for integration
let g:ale_python_auto_pipenv = 1
" ycm
" Auto close after completion
let g:ycm_autoclose_preview_window_after_completion = 1
" Don't ask about local ycm_extra_conf.py
let g:ycm_confirm_extra_conf = 0
" airline
" Turn on status line
set laststatus=2
" Use powerline fonts
let g:airline_powerline_fonts = 1
" Use powerlineish theme
let g:airline_theme='powerlineish'
" Automatically displays all buffers when there's only one tab open.
let g:airline#extensions#tabline#enabled = 1
set hidden
" tagbar
" focus tagbar when it is opened.
let g:tagbar_autofocus = 1
" vim-javascript
" set concealing
set conceallevel=1
let g:javascript_conceal_function = "ƒ"
let g:javascript_conceal_null = "ø"
let g:javascript_conceal_this = "@"
let g:javascript_conceal_return = "⇚"
let g:javascript_conceal_undefined = "¿"
let g:javascript_conceal_NaN = "ℕ"
let g:javascript_conceal_prototype = "¶"
let g:javascript_conceal_static = "•"
let g:javascript_conceal_super = "Ω"
let g:javascript_conceal_arrow_function = "⇒"
" fzf
" Install fzf itself by homebrew
set rtp+=/usr/local/opt/fzf
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" [Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" [Tags] Command to generate tags file
let g:fzf_tags_command = 'ctags -R'
" [Commands] --expect expression for directly executing the command
let g:fzf_commands_expect = 'alt-enter,ctrl-x'
" fzf with ripgrep
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%'),
\ <bang>0)
" fzf ':Files' with preview
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" delimitmate
let g:delimitMate_expand_cr = 2
let g:delimitMate_expand_space = 1
" PreserveNoEOL
let g:PreserveNoEOL = 1
" vim-markdown-preview
" automatical buffer write
let vim_markdown_preview_toggle=0
" change hot-key config. <C-p> is already occupied
let vim_markdown_preview_hotkey='<C-m>'
" use 'Github flavored markdown' as default
" it require 'Python grip'
" 'pip install grip', or 'brew install grip'
let vim_markdown_preview_github=1