gpt4 book ai didi

vim - 如何整理我的 vimrc 文件?

转载 作者:行者123 更新时间:2023-12-01 07:42:19 25 4
gpt4 key购买 nike

我的 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 会更快地启动。但我不知道该怎么做。

我们可以将它们分组吗?如何?还要别的吗?

最佳答案

就放

setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=78 formatoptions-=t
match ErrorMsg '\%>80v.\+'
inoremap <F5> <esc>:upd\|!python %<cr>
nnoremap <F5> :upd\|!python %<cr>
nnoremap <leader>8 :w\|call Flake8()<cr>

~/.vim/after/ftplugin/python.vim .

只有当你打开一个 Python 文件时,Vim 才会读取这个文件。

事实上,我想这样做已经有一段时间了。出于同样的原因。

关于vim - 如何整理我的 vimrc 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12139187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com