-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc.local
executable file
·233 lines (185 loc) · 6.9 KB
/
.vimrc.local
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
nnoremap [m <Esc> : tabprevious<CR>
nnoremap ]m <Esc> : tabnext<CR>
nnoremap <C-t> : tabnew<CR>
inoremap <C-t><Esc> : tabnew<CR>
" 临时映射 <F5>
" Python
" if mapcheck('<F5>') == ""
" noremap <F5> :!python %<CR>
" inoremap <F5> <ESC><ESC>:w<CR>:!python %<CR>
" endif
" shell script
" noremap <F5> <ESC>:w<CR>:!sh ./%<CR>
" inoremap <F5> <ESC><ESC>:w<CR>:!sh ./%<CR>
" Go Lang
" au Filetype go set makeprg=go\ build\ ./...
" noremap <F5> :make<CR>:copen<CR>
" inoremap <F5> <ESC><ESC>:w<CR>:make><CR>:copen<CR>
" 请勿在项目文件中使用以下快捷键映射
" <F7> <Esc>: call Pylon_prj_cmd("build_index.sh") <CR>
" <F8> <Esc>: call Pylon_prj_cmd(g:pylon_prj_init) <CR>
" <F9> <Esc>: call Pylon_build_index() <CR>
nnoremap <F5> : VJNERDTreeRefresh<CR>
nnoremap <silent><F7> : TagbarToggle<CR>
nnoremap \t : TagbarToggle<CR>
nnoremap <silent><F10> : NERDTreeTabsToggle<CR>
nnoremap \n : NERDTreeTabsToggle<CR>
" <Leader>快捷键定义
" let mapleader = '\'
" 快速使.vimrc配置生效
map <silent> <Leader>V :source ~/.vimrc<CR>:filetype detect<CR>
" 快速保存
map <silent> `s <Esc>:w<CR>:exe ":echo 'saved'"<CR>
" 零时获取sudo权限[w!!]
cmap w!! %!sudo tee > /dev/null %
" CtrlP <C-p>
" noremap <Leader>be <Esc>:CtrlPBuffer<CR>
noremap <Leader>bm <Esc>:CtrlPMRU<CR>
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$|(node_modules|_prj|tmp)$',
\ 'file': '\v\.(exe|so|dll)$|.prjide',
\ 'link': 'some_bad_symbolic_links',
\ }
"智能大小写
set ignorecase
set smartcase
nmap <F3> <Esc>:CtrlP<CR>
" DoxygenToolkit.vim
" 生成Doxygen风格的文档注释
noremap <Leader>dc <Esc>:Dox<CR>
noremap <Leader>da <Esc>:DoxAuthor<CR>
" noremap <Leader>dd <Esc>:DoxUndoc<CR>
" tcommment_vim
" 代码注释
noremap <Leader>x :TComment<cr>
noremap <Leader>X :TCommentRight<cr>
xnoremap <Leader>x :TCommentMaybeInline<cr>
noremap <Leader>C :TCommentMaybeInline<cr>
noremap <Leader>c :TCommentBlock<cr>
xnoremap <Leader>c :TCommentBlock<cr>
" NERDTree<F10>
" 左侧文件菜单插件
" Scroll from source
noremap <Leader>sf <Esc>:NERDTreeFind<CR>
" NerdTree没有箭头
let g:NERDTreeDirArrows = 0
" 隐藏帮助说明和书签
let NERDTreeMinimalUI = 1
" 在新标签中打开文件后,默认开启 NERDTree
let g:nerdtree_tabs_open_on_console_startup=1
" 默认是否用 l 代替 o 打开文件
let g:vj_nerdtree_compatible = 1
" autocmd VimEnter * NERDTreeTabsToggle
" --- 若NERDTree是关闭其他Buffer后剩下的唯一窗口,则退出Vim
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" let g:nerdtree_tabs_autoclose=0
" --- 若使用Vim打开某个文件,则自动打开NERDTree的同时,将焦点也转移至新文件中
" autocmd VimEnter * if argc() | wincmd p | endif
" tagbar右侧结构树<F12>
" tagbar-phpctags
let g:tagbar_indent = 1
let g:tagbar_autofocus = 1
" -- 用「相对行数」+ [j/k] 或「绝对行数」+ G 快速移动
" 相对行数2,绝对行数值为1。
let g:tagbar_show_linenumbers = 1
let g:tagbar_zoomwidth = 1
" let g:tagbar_autopreview = 1
" let g:tagbar_autoclose = 1
let g:tagbar_phpctags_memory_limit = '512M'
let g:tagbar_width = 30
let g:tagbar_type_go = {
\ 'ctagstype': 'go',
\ 'kinds' : [
\'p:package',
\'f:function',
\'v:variables',
\'t:type',
\'c:const'
\]
\}
let g:tagbar_type_javascript = {'ctagsbin' : '/usr/local/bin/jsctags' }
" cscope
"" Avoiding duplicate cscope database error within VIM
set nocscopeverbose
" set cscopetag
" phpfolding.vim
let php_folding=0
autocmd FileType php setlocal foldmethod=manual
autocmd FileType php nnoremap ++ :DisablePHPFolds<CR>
autocmd FileType php nnoremap -- :EnableFastPHPFolds<CR>
" 在{与}之间换行,能自动插入新行
autocmd FileType php,javascript inoremap {<CR> {<CR>}<Esc>O<BS><Tab>
" Ctags
let g:prj = getcwd()
func! UpdatePrjTags()
" 将 _prj/ 下 tags 结尾的文件
let a:tag_list=split(globpath(g:prj."/_prj/", '*tags'), "\n")
set tags=
let i=0
while i<len(a:tag_list)
if filereadable(a:tag_list[i])
" echo a:tag_list[i]
execute "set tags+=".a:tag_list[i]
endif
let i+=1
endwhile
endf
if filereadable('./_prj/tags')
:call UpdatePrjTags()
endif
" 避免和supertab冲突
let g:SuperTabDefaultCompletionType = "context"
" 关闭phpcomplete 跳转功能,完全使用 ctags 与 cscope
let g:phpcomplete_enhance_jump_to_definition=0
" 弹出窗口快捷键映射
" inoremap <expr><CR> pumvisible() ? "\<C-y>\<CR>" : "\<CR>"
" inoremap <expr><Esc> pumvisible() ? "\<C-e>\<Esc>" : "\<Esc>"
" inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
" inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
" phpqa
let g:phpqa_codesniffer_args = "--standard=Zend"
" Don't run codesniffer on save (default = 1)
let g:phpqa_codesniffer_autorun = 0
let g:phpqa_messdetector_autorun = 0
" vim-easy-align
vmap <Enter> <Plug>(EasyAlign)
vnoremap <Leader>: :EasyAlign:s0l1<CR>
" vim-jsbeautify
" unmap! <c-f>
autocmd FileType javascript noremap <buffer> <Leader>ff : Autoformat<CR>
autocmd FileType html noremap <buffer> <Leader>ff : call HtmlBeautify()<CR>
autocmd FileType css noremap <buffer> <Leader>ff : call CSSBeautify()<CR>
autocmd FileType php noremap <buffer> <Leader>ff : call VjPhpBeautify()<CR>
autocmd FileType javascript vnoremap <buffer> <Leader>ff : Autoformat<CR>
autocmd FileType html vnoremap <buffer> <Leader>ff : call RangeHtmlBeautify()<CR>
autocmd FileType css vnoremap <buffer> <Leader>ff : call RangeCSSBeautify()<CR>
" 切换php/html/javascript文件类型以配合缩进和语法补全
autocmd FileType html,php,javascript map <buffer> <Leader>ft :call VjFileTypeToggle()<CR>
" EasyMotion
" 快速移动
" let g:EasyMotion_leader_key='<leader>'
" map <C-O> <Leader><Leader>w
" map <C-E> <Leader><Leader>W
" 永远屏蔽补全Scrtach Preview窗口
set completeopt-=preview
" 离开插入模式或者在插入模式中移动时,关闭 Scratch Preview窗口
" autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
" autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" --- Emmet/ZenCoding
" --- 快速生成任意HTML/CSS/XSL标签的「组合」
"--: Redefine trigger key
" let g:user_emmet_leader_key='<c-z>'
" 打开VJ时是否定位到最后一个编辑的文件
" g:vj_open_last_file_mode = 1
" Nerdtree定位到最后一个文件
" g:vj_source_from_code_mode = 0
" Ag.vim
let g:agprg="ag --skip-vcs-ignores --smart-case --ignore-dir={_prj,node_modules,tmp} --column"
nnoremap <C-W>O :call VjMaximizeToggle()<CR>
nnoremap <C-W>o :call VjMaximizeToggle()<CR>
nnoremap <C-W><C-O> :call VjMaximizeToggle()<CR>
" vim-phpcheck
" 写入文件时自动保存
" let g:php_check_autorun = 1
noremap <F6> :call CallPhpCheckSyntax()<CR>
inoremap <F6> <ESC>:call CallPhpCheckSyntax()<CR>