-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
315 lines (278 loc) · 7.83 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
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'vim-scripts/L9'
Plugin 'mattn/emmet-vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'ivalkeen/nerdtree-execute'
Plugin 'scrooloose/nerdcommenter' " comment code
Plugin 'junegunn/vim-easy-align' " algin cols
Plugin 'SirVer/ultisnips'
Plugin 'tpope/vim-fugitive' " git
Plugin 'juneedahamed/svnj.vim' " svn
Plugin 'yssl/QFEnter' " quickfix
" Plugin 'feix760/autospace.vim'
Plugin 'feix760/taboo.vim'
Plugin 'Chiel92/vim-autoformat'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'othree/html5.vim'
Plugin 'plasticboy/vim-markdown'
Plugin 'hail2u/vim-css3-syntax'
" Plugin 'ashisha/image.vim'
" Plugin 'leafgarland/typescript-vim'
Plugin 'Quramy/tsuquyomi'
Plugin 'HerringtonDarkholme/yats.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'MaxMEllon/vim-jsx-pretty'
Plugin 'zerowidth/vim-copy-as-rtf'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'easymotion/vim-easymotion'
Plugin 'groenewege/vim-less'
Plugin 'posva/vim-vue'
Plugin 'Quramy/tsuquyomi-vue'
Plugin 'feix760/vim-javascript-gf'
" Plugin 'marijnh/tern_for_vim'
" Plugin 'niftylettuce/vim-jinja'
Plugin 'vim-syntastic/syntastic'
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'vim-scripts/actionscript.vim'
Plugin 'dart-lang/dart-vim-plugin'
Plugin 'jasonshell/vim-svg-indent'
call vundle#end()
filetype plugin indent on
" let g:netrw_altv = 1
let g:NERDSpaceDelims = 1
" let g:NERDCompactSexyComs = 1
" let g:NERDCommentEmptyLines = 1
let g:NERDTreeIgnore = [ '^_.*@.*@[[dir]]' ]
let g:NERDTreeRespectWildIgnore = 1
let g:jsx_ext_required = 0
set completeopt-=preview
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
let g:ycm_auto_trigger = 0
let g:ycm_key_invoke_completion = '<C-N>'
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:autoformat_verbosemode = 1
let g:formatters_javascript = ['jsbeautify_javascript']
let g:formatters_jsx = ['jsbeautify_javascript', 'pyjsbeautify_javascript', 'jscs']
let g:formatters_javascript_jsx = ['jsbeautify_javascript', 'pyjsbeautify_javascript', 'jscs']
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_no_default_key_mappings = 1
let mapleader = ","
let g:mapleader = ","
nn \ ,
com! Sdiff SVNDiff
com! Sblame SVNBlame
let g:taboo_tab_format = ' %N%m %s '
let g:taboo_modified_tab_flag = '+'
let g:snips_author = '飞羏'
let g:snips_mail = 'feixiang.yfx@alibaba-inc.com'
let g:qfenter_open_map = ['<CR>', 'o']
let g:qfenter_vopen_map = ['<C-v>']
let g:qfenter_hopen_map = ['<C-x>']
let g:qfenter_topen_map = ['<C-t>']
let g:NERDTreeWinSize = 20
nn <leader>n :NERDTreeToggle<cr>
let g:tagbar_type_javascript = {
\ 'ctagsbin': '/usr/local/bin/jsctags'
\ }
nn <leader>t :TagbarToggle<cr>
let g:ctrlp_map = '<c-u>'
let g:ctrlp_working_path_mode = 'w'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|\.hg|\.svn|node_modules.*|dist|public|bin-debug|bin-release)$',
\ 'file': '\v\.(exe|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:tsuquyomi_disable_default_mappings = 1
let g:tsuquyomi_disable_quickfix = 1
let g:tsuquyomi_definition_split = 3
autocmd FileType typescript nn <buffer> <C-]> :TsuDefinition<CR>
autocmd FileType typescriptreact nn <buffer> <C-]> :TsuDefinition<CR>
autocmd FileType vue nn <buffer> <C-]> :TsuDefinition<CR>
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_typescript_checkers = ['tsuquyomi'] " You shouldn't use 'tsc' checker.
let g:syntastic_typescriptreact_checkers = ['tsuquyomi'] " You shouldn't use 'tsc' checker.
let g:syntastic_mode_map = {
\ 'active_filetypes': [ 'typescript', 'typescriptreact' ],
\ "mode": "passive",
\ "passive_filetypes": [] }
set diffopt=vertical
let g:user_emmet_settings = {
\ 'variables': {
\ 'lang': "zh_CN",
\ 'locale': "zh_CN"
\ },
\ 'html' : {
\ 'default_attributes': {
\ 'script': [],
\ 'button': [{'type': 'button'}]
\ }
\ }
\ }
runtime macros/matchit.vim
syntax enable
set synmaxcol=400 " prevent slow when a line is too long
set background=dark
colorscheme desert
set hidden
set cursorline
set showcmd
set number
set history=700
filetype plugin on
filetype indent on
set ai "Auto indent
set wrap "Wrap lines
set autoread
set helplang=cn
set wildignore=*.o,*~,*.pyc,*.swp
set ruler
set showmatch
set cmdheight=2
set ignorecase
set hlsearch
set incsearch
set expandtab
set smarttab
set shiftwidth=2
set tabstop=2
" Files, backups and undo
set nobackup
set nowb
set noswapfile
" Linebreak on 500 characters
" set lbr
set tw=500
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
set fileencodings=utf-8,gbk,big5
set colorcolumn=101
highlight colorcolumn ctermbg=red ctermfg=white
au BufEnter *.js,*.jsx,*.html,*.scss,*.less,*.tpl,*.vue,*.ts,*.tsx,*.xml,*.exml match ExtraWhitespace /\s\+$/
hi ExtraWhitespace ctermbg=red guibg=red
nn <leader>w :w<cr>
nn <leader>q :q<cr>
nn <space> /
vn <space> "/y/\V<c-r>"<cr>
" window
nn <C-j> <C-W>j
nn <C-k> <C-W>k
nn <C-h> <C-W>h
nn <C-l> <C-W>l
nn ( f(
nn ) f)
vn ( f(
vn ) f)
" just back (
nn ,) )
nn ,( (
vn ,( (
vn ,) )
" parent block
nn { [{
nn } ]}
nn ,{ ?}<cr>:noh<cr>%
nn ,} /{<cr>:noh<cr>%
vn { [{
vn } ]}
" html parent node
nn [t vatatov
nn ]t vatatv
nn <leader>a VggoG
nn <c-n> gt
nn <c-p> gT
ino <c-h> <Left>
ino <c-j> <Down>
ino <c-k> <Up>
ino <c-l> <right>
ino <c-c> <esc>
cno <c-p> <up>
cno <c-n> <down>
vn <c-c> <esc>
nn <c-m> :noh<cr>
" add(use) new line blow
nn <s-u> o<esc>
" break(kill) to new line
nn <s-k> i<cr><esc>
" folder
nn zt zfat
nn z[ :sil! normal $zfa{<cr>
" set fdm=syntax
set isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=,@-@
nn <leader>p "0p
nn <leader><s-p> "0P
vn <leader>p "0p
vn <leader><s-p> "0P
nn <leader>d "_d
vn <leader>d "_d
set pastetoggle=<f5>
set iskeyword+=-,$
nnoremap <F5> :buffers<CR>:buffer<Space>
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
hi MatchParen cterm=none ctermbg=green ctermfg=white
" wechat wxml/wxss
au BufEnter *.wxml exe ":set ft=xml"
au BufEnter *.wxss exe ":set ft=css"
au BufEnter *.js,*.html,*.scss,*.less
\ if &fileencoding != 'utf-8' | echo 'Warn: encoding is '.&fileencoding .', not utf-8' | endif
" Return to last edit position when opening files
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" diff change
fun! s:DiffChange()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfun
com! DiffChange call s:DiffChange()
com! Gb Git blame
com! CamelCase s#_\(\l\)#\u\1#g
" toggle line number
nn <silent> <f6> :if &number \| set nonumber \| else \| set number \| endif<cr>
" use ctrlp to search file under the cursor
fun! SearchFileUnderCursor()
let line = getline('.')
let start = col('.') - 1
let chars = '[[:alnum:]-_./\\]\+'
while start >= 0 && match(line[start], chars) >= 0
let start -= 1
endwhile
let str = matchstr(line, chars, start)
let str = substitute(substitute(str, '^\.\+', '', ''), '^[\\/]', '', '')
if str != ''
let g:ctrlp_lazy_update = 10
CtrlP
exe 'normal '.substitute(str, '[\-]', '', 'g')
let g:ctrlp_lazy_update = 0
endif
endfun
au BufEnter *.js,*.html,*.scss,*.less,*.tpl,*.ts nn <buffer> gp :call SearchFileUnderCursor()<cr>
au BufNewFile,BufRead *.tpl set ft=jinja
au BufNewFile,BufRead *.axml set ft=xml
au BufNewFile,BufRead *.as set ft=java
au BufNewFile,BufRead *.acss set ft=.sass
au BufNewFile,BufRead *.snap set ft=javascript
set complete-=i
" macvim
set guifont=Menlo:h18
set guioptions-=L
let g:pymode_python = 'python3'
set wildignore+=*/app/web/node_modules/*