-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
executable file
·493 lines (440 loc) · 18.1 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
" . . . . . . . S@t.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
" . ..t%SXSS%:;t.X8S% . . . . . . . . . . . . .
" . %St8;8:X;8:8:8%8;%%:@S: . . . . .... . . . . . . . . . . . . . . . ....
" . 8: %.;t;S;%@88:X.8X8%;8S t@@% . %@@t .X88X . . . %@@@@@@@@@X: . . . . .
" ..X.;X%8t8%8ttX.88;8.8%:;% ;8:SX%. SX.8S. St88: . . . . ..XS.@%SSS88S@:. X@@% . . . . . . ......
" . X;:;8SS888;8tt;8:8:8; t:t8S 8:Xt. :8888: .%888:. .SSSSSSSSSSS%: .S888t @@8X: .%.88 .SSt .:SS; .%SSSSSSSS%.
" :t8 :;X8S;8.8S;8S.8.t8:%8XS.. S8.8:.S8;8; :@;@88 . S:88 X.88@88:@t..%S. .. X;8@: :%:;8. X%:X;. 8;.; %S8@XXSXSS8..
" .t88; X;8S8888;8S8t 8S88SSStt:. @.%8St;@8X . t .8S S:88:%888%;8t8:..S.S@%SSS8S88t .% @; X:.X. 88t :.t@t8@ .......
" 8; :888XSStS;88;88X%;;tt::;;8@ ..%X88:88Xt .S@.::. S@8% X8.@;S888X .%;88SSSS.SX.:. 8S88: @;88t. 8.S8 t;@8@88@88S..
" S. :tX: ;%8S8 : .::. %8t %S 8. @88t8 8t. . . .@8; 8888 @@%S;t8.8S .:SX8; .:.... . S8; ..8888:..8:8@: ;St@@888.@@..
" :8:;888888 .; . 8%8@ .8X.@8X . X%8@ .t@8S X88X:%888X .@8@8t .. . SX%X .X;;S@%tS8; ;..SttSXS8888S.
" t.8XX;;8X% XX. . %8X8; . :tX8@t . t8X8: %@@S X8@@:t8tXt...:%t.. . X:8X X8@@88@888t. %88t888 888t.
" . :8;S: . S@. t8;8:: . .;:;. . . .%@%: t%%; .%%;..: t. .; : . . . %;8. ;X;X%.:.: t ;t ;:: :t;..
" :%@t%8 88. . . :: . .. . . . . .. . .. . . . . ... . . . . ..
" .. 8888 .. ... . . . . . . . .. . . . . . . .. . . . . . . ....
"
" Author: chxuan <787280310@qq.com>
" Repository: https://github.com/chxuan/vimplus
" Create Date: 2016-04-10
" License: MIT
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 通用设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = "," " 定义<leader>键
set nocompatible " 设置不兼容原始vi模式
filetype on " 设置开启文件类型侦测
filetype plugin on " 设置加载对应文件类型的插件
set noeb " 关闭错误的提示
syntax enable " 开启语法高亮功能
syntax on " 自动语法高亮
" set cursorcolumn " 设置光标所在列高亮
" set mouse=a " 开启鼠标
set t_Co=256 " 开启256色支持
set cmdheight=2 " 设置命令行的高度
set textwidth=90 " 最大行字符数
set showcmd " select模式下显示选中的行数
set ruler " 总是显示光标位置
set laststatus=2 " 总是显示状态栏
set scrolloff=5 " 垂直滚动时,光标距离顶部/底部的位置
set number " 开启行号显示
" set relativenumber " 开启相对行号
set cursorline " 高亮显示当前行
set whichwrap+=<,>,h,l " 设置光标键跨行
set ttimeoutlen=0 " 设置<ESC>键响应时间
set virtualedit=block,onemore " 允许光标出现在最后一个字符的后面
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 代码缩进和排版
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent " 设置自动缩进
let g:indentLine_enabled = 1 " 开启代码对齐线
" set cindent " 设置使用C/C++语言的自动缩进方式
" set cinoptions=g0,:0,N-s,(0 " 设置C/C++语言的具体缩进方式
set smartindent " 智能的选择对其方式
filetype indent on " 自适应不同语言的智能缩进
set expandtab " 将制表符扩展为空格
set tabstop=4 " 设置编辑时制表符占用空格数
set shiftwidth=4 " 设置格式化时制表符占用空格数
set softtabstop=4 " 设置4个空格为制表符
set smarttab " 在行和段开始处使用制表符
set wrap " 禁用折行
set backspace=2 " 使用回车键正常处理indent,eol,start等
set sidescroll=10 " 设置向右滚动字符数
set nofoldenable " 禁用折叠代码
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 代码补全
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set wildmenu " vim自身命名行模式智能补全
set completeopt-=preview " 补全时不显示窗口,只显示补全列表
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 搜索设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch " 高亮显示搜索结果
set incsearch " 开启实时搜索功能
set ignorecase " 搜索时大小写不敏感
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 缓存设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nobackup " 设置不备份
set noswapfile " 禁止生成临时文件
set autoread " 文件在vim之外修改过,自动重新读入
set autowrite " 设置自动保存
set confirm " 在处理未保存或只读文件的时候,弹出确认
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 编码设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set langmenu=zh_CN.UTF-8
set helplang=cn
set termencoding=utf-8
set encoding=utf8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" gvim/macvim设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("gui_running")
let system = system('uname -s')
if system == "Darwin\n"
set guifont=Droid\ Sans\ Mono\ Nerd\ Font\ Complete:h18 " 设置字体
else
set guifont=DroidSansMono\ Nerd\ Font\ Regular\ 18 " 设置字体
endif
set guioptions-=m " 隐藏菜单栏
set guioptions-=T " 隐藏工具栏
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
set showtabline=0 " 隐藏Tab栏
set guicursor=n-v-c:ver5 " 设置光标为竖线
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 卸载默认插件UnPlug
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:deregister(repo)
let repo = substitute(a:repo, '[\/]\+$', '', '')
let name = fnamemodify(repo, ':t:s?\.git$??')
call remove(g:plugs, name)
endfunction
command! -nargs=1 -bar UnPlug call s:deregister(<args>)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 插件列表
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" Plug 'chxuan/cpp-mode'
Plug 'chxuan/vim-edit'
Plug 'chxuan/change-colorscheme'
" Plug 'chxuan/prepare-code'
Plug 'chxuan/vim-buffer'
Plug 'chxuan/vimplus-startify'
Plug 'preservim/tagbar'
" Plug 'ycm-core/YouCompleteMe'
" Plug 'Yggdroot/LeaderF'
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'mileszs/ack.vim'
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'preservim/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-fugitive'
Plug 'rbong/vim-flog'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
" Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/vim-slash'
Plug 'junegunn/gv.vim'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-syntax'
" Plug 'vim-syntastic/syntastic'
Plug 'kana/vim-textobj-function'
Plug 'sgur/vim-textobj-parameter'
Plug 'Shougo/echodoc.vim'
Plug 'terryma/vim-smooth-scroll'
Plug 'rhysd/clever-f.vim'
Plug 'vim-scripts/indentpython.vim'
" Plug 'prabirshrestha/vim-lsp'
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'heavenshell/vim-pydocstring', { 'do': 'make install', 'for': 'python' }
Plug 'Chiel92/vim-autoformat'
Plug 'davidhalter/jedi-vim'
Plug 'dense-analysis/ale'
Plug 'airblade/vim-gitgutter'
Plug 'ervandew/supertab'
Plug 'tpope/vim-dadbod'
Plug 'kristijanhusak/vim-packager'
Plug 'kristijanhusak/vim-dadbod-ui'
Plug 'dhruvasagar/vim-zoom'
" Plug 'morhetz/gruvbox'
" Plug 'vim-python/python-syntax'
Plug 'NLKNguyen/papercolor-theme'
Plug 'dracula/vim', {'as': 'dracula'}
" Plug 'ayu-theme/ayu-vim'
" Plug 'rainglow/vim'
" Plug 'arcticicestudio/nord-vim', { 'branch': 'main' }
" Plug 'liuchengxu/space-vim-dark'
" Plug 'jdkanani/vim-material-theme'
" Plug 'sainnhe/everforest'
"
" Java autocomplete
Plug 'artur-shaik/vim-javacomplete2'
" Plug 'inkarkat/vim-mark'
call plug#end()
""""""""""""""""""""""""""""""""""""" ale-setting
let g:ale_set_highlights = 1
"自定义error和warning图标
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚡'
"在vim自带的状态栏中整合ale
let g:ale_statusline_format = ['✗ %d', '⚡ %d', '✔ OK']
"显示Linter名称,出错或警告等相关信息
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
"打开文件时不进行检查
let g:ale_lint_on_enter = 1
" Set this variable to 1 to fix files when you save them.
let g:ale_fix_on_save = 0
" 普通模式下,sp前往上一个错误或警告,sn前往下一个错误或警告
let g:ale_open_list = 0
" let g:ale_exclude_highlights = ['line too long']
" let g:ale_keep_list_window_open = 1
nmap sp <Plug>(ale_previous_wrap)
nmap sn <Plug>(ale_next_wrap)
" <Leader>S 触发/关闭语法检查
nmap <Leader>S :ALEToggle<CR>
" <Leader>D 查看错误或警告的详细信息
nmap <Leader>D :ALEDetail<CR>
" 对python使用pylint进行语法检查
let g:ale_linters = {'python': ['flake8'],}
let g:ale_fixers = {
\'*': ['remove_trailing_lines', 'trim_whitespace'],
\'python': ['yapf', 'isort', 'add_blank_lines_for_python_control_statements']
\}
" python
" alternative linter: pylint(严格), flake8(精简)
" alternative fixer: yapf, black
noremap <F2> :ALEFix<cr>
" load vim default plugin
runtime macros/matchit.vim
" 编辑vimrc相关配置文件
nnoremap <leader>e :edit $MYVIMRC<cr>
nnoremap <leader>vc :edit ~/.vimrc.custom.config<cr>
nnoremap <leader>vp :edit ~/.vimrc.custom.plugins<cr>
" 查看vimplus的help文件
nnoremap <leader>h :view +let\ &l:modifiable=0 ~/.vimplus/help.md<cr>
" 打开当前光标所在单词的vim帮助文档
nnoremap <leader>H :execute ":help " . expand("<cword>")<cr>
" 重新加载vimrc文件
nnoremap <leader>s :source $MYVIMRC<cr>
" 安装、更新、删除插件
nnoremap <leader><leader>i :PlugInstall<cr>
nnoremap <leader><leader>u :PlugUpdate<cr>
nnoremap <leader><leader>c :PlugClean<cr>
" 分屏窗口移动
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" 复制当前选中到系统剪切板
vmap <leader><leader>y "+y
" 将系统剪切板内容粘贴到vim
nnoremap <leader><leader>p "+p
" 打开文件自动定位到最后编辑的位置
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g'\"" | endif
" 主题设置
set background=dark
let g:onedark_termcolors=256
" colorscheme molokai
" colorscheme gruvbox
colorscheme dracula
" auto-pairs
let g:AutoPairsFlyMode = 1
" airline
" let g:airline_theme="onedark"
" let g:airline_theme="gruvbox"
let g:airline_theme="dracula"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#ale#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" change-colorscheme
nnoremap <silent> <F9> :PreviousColorScheme<cr>
inoremap <silent> <F9> <esc> :PreviousColorScheme<cr>
nnoremap <silent> <F10> :NextColorScheme<cr>
inoremap <silent> <F10> <esc> :NextColorScheme<cr>
nnoremap <silent> <F11> :RandomColorScheme<cr>
inoremap <silent> <F11> <esc> :RandomColorScheme<cr>
nnoremap <silent> <F12> :ShowColorScheme<cr>
inoremap <silent> <F12> <esc> :ShowColorScheme<cr>
" vim-buffer
nnoremap <silent> <c-p> :PreviousBuffer<cr>
nnoremap <silent> <c-n> :NextBuffer<cr>
nnoremap <silent> <leader>c :CloseBuffer<cr>
" nnoremap <silent> <leader>D :BufOnly<cr>
" vim-edit
nnoremap Y :CopyText<cr>
nnoremap D :DeleteText<cr>
nnoremap C :ChangeText<cr>
nnoremap <leader>R :ReplaceTo<space>
" nerdtree
nnoremap <silent> <leader>n :NERDTreeToggle<cr>
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
let g:NERDTreeHighlightCursorline = 1
let g:NERDTreeHighlightFolders = 1
let g:NERDTreeHighlightFoldersFullName = 1
let g:NERDTreeDirArrowExpandable='▶'
let g:NERDTreeDirArrowCollapsible='▼'
let g:NERDTreeIgnore = ['__pycache__', '\.pyc$', '\.tar']
let g:NERDTreeWinSize = 40
" Start NERDTree when Vim starts with a directory argument.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
" tagbar
let g:tagbar_width = 50
nnoremap <silent> <leader>t :TagbarToggle<cr>
let g:tagbar_sort=0
" incsearch.vim
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" vim-easymotion
let g:EasyMotion_smartcase = 1
map <leader>w <Plug>(easymotion-bd-w)
nmap <leader>w <Plug>(easymotion-overwin-w)
" nerdtree-git-plugin
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
" LeaderF
nnoremap <leader>f :LeaderfFile .<cr>
let g:Lf_WildIgnore = {
\ 'dir': ['.svn','.git','.hg','.vscode','.wine','.deepinwine','.oh-my-zsh'],
\ 'file': ['*.sw?','~$*','*.bak','*.exe','*.o','*.so','*.py[co]']
\}
let g:Lf_UseCache = 0
" ack
nnoremap <leader>F :Ack!<space>
" " echodoc.vim
" let g:echodoc#enable_at_startup = 1
" let g:echodoc#type = 'floating'
" tabular
nnoremap <leader>l :Tab /\|<cr>
nnoremap <leader>= :Tab /=<cr>
" vim-smooth-scroll
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
" gv
nnoremap <leader>gv :GV<cr>
nnoremap <leader>G :GV!<cr>
nnoremap <leader>gg :GV?<cr>
" Autoformat F3自动格式化代码
noremap <F3> :Autoformat<CR>
let g:autoformat_verbosemode=1
" SuperTab
let g:SuperTabDefaultCompletionType = "context"
" vim poplist movement
" inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <C-J> pumvisible() ? "<PageDown>\<C-N>\<C-P>" : "<C-X>\<C-O>"
inoremap <expr> <C-K> pumvisible() ? "<PageUp>\<C-P>\<C-N>" : "\<C-K>"
" Jedi-vim
" let g:jedi#use_tabs_not_buffers=1
let g:jedi#smart_auto_mappings=1
let g:jedi#popup_on_dot = 0
" let g:jedi#environment_path=""
let g:jedi#show_call_signatures = "1"
" let g:jedi#goto_command = "<leader>g"
let g:jedi#goto_definitions_command = "<leader>d"
let g:jedi#goto_assignments_command = "<leader>g"
" let g:jedi#goto_stubs_command = "<leader>s"
" let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>u"
" let g:jedi#completions_command = "<Tab>"
" let g:jedi#rename_command = "<leader>r"
" Pydocstring
" let g:pydocstring_ignore_init = 1
nmap <silent> <C-_> <Plug>(pydocstring)
let g:pydocstring_formatter = 'google' " Choice: 'Sphinx', 'Numpy', 'Google'
" let g:pydocstring_templates_path = ''
" Add python filehead comment
function AddFileComment()
let n = 0
call append(n, "###############################################################################")
let n += 1
call append(n, "# Copyright (C) ".strftime("%Y")." All rights reserved.")
let n += 1
call append(n, "# Filename: ".expand("%:t"))
let n += 1
call append(n, "# Author: Tsingwaa")
let n += 1
call append(n, "# Email: zengchh3@gmail.com")
let n += 1
call append(n, "# Created Time : ".strftime("%Y-%m-%d %H:%M %A"))
let n += 1
call append(n, "# Last modified: ".strftime("%Y-%m-%d %H:%M %A"))
let n += 1
call append(n, "# Description:")
let n += 1
call append(n, "#")
let n += 1
call append(n, "###############################################################################")
let n += 1
call append(n, "")
echohl WarningMsg | echo "Added filehead comment successfully." | echohl None
endf
" Update filehead comment 'Last modified' and 'Filaname'
function UpdateFileComment()
let l = 1
let flag = 0
while l < 10
let line = getline(l)
if line =~ '^\# Last modified'
call setline(l, "# Last modified: ".strftime("%Y-%m-%d %H:%M %A"))
let flag += 1
endif
if line =~ '^\# Filename'
call setline(l, "# Filename: ".expand("%:t"))
let flag += 1
endif
if flag == 2
echohl WarningMsg | echo "Updated filehead comment successfully." | echohl None
return
endif
let l += 1
endwhile
call AddFileComment()
endfunction
" Add Filecomment when create new python file.
autocmd BufNewFile *.py exec ":call AddFileComment()"
" autocmd BufNewFile,BufWrite *.py exec ":call UpdateFileComment()"
" Manually update filecomment
map <F4> :call UpdateFileComment()<cr>
" 自动将光标移动到文件末尾
" autocmd BufNewfile * normal G