我有以下设置文件:
# ~/.vimrc
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent
我如何使这些设置仅适用于python?另外,我将如何添加 python 着色(例如 textmate 为每种语言所做的)?
我的配置中有这些行:
filetype plugin indent on
syntax on
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent
这可能是您正在寻找的颜色: 改进的 Python 语法、黑板配色方案
将它们放入vimfiles/ftplugin/python.vim
(但更改set
为setlocal
)并添加filetype plugin on
到.vimrc
. 对于语法高亮,添加syntax on
到.vimrc
.
除了上述之外,试试vim-janus,它为 vim 添加了其他好东西。