【发布时间】:2012-08-27 09:15:58
【问题描述】:
我的 Vim 配置文件越来越大(15KB+)。而且我尽量不通过在启动时采购更多 (更大) 文件来降低我的 vim 启动速度。出于同样的目的,我只使用必要的插件,并尽量减少插件的数量。
所以,在我的 .vimrc 文件的某处,我有以下几行:
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
autocmd FileType python setlocal textwidth=78
autocmd FileType python match ErrorMsg '\%>80v.\+'
autocmd FileType python inoremap <F5> <esc>:upd\|!python %<cr>
autocmd FileType python nnoremap <F5> :upd\|!python %<cr>
autocmd FileType python nnoremap <leader>8 :w\|call Flake8()<cr>
autocmd FileType python setlocal formatoptions-=t
autocmd BufWritePost *.py call Flake8()
现在我看到前 7 行,所有行都有 autocmd FileType python 共同点。所以我的想法是,如果我们设法用更少的东西替换所有这些词,那么 Vim 会更快启动。但我不知道该怎么做。
我们可以将它们分组吗?如何?还有什么?
【问题讨论】:
-
强制巨魔:
:%d最好地清理你的 vimrc。或者,:new|saveas! $MYVIMRC非常有效 -
另外,稍微少一点拖钓,
:help autocmd-groups