Jon*_*han 32 python vim coding-style
当我编辑"*.py"文件而不是任何其他文件时,如何让tab键插入4个空格?
根据Vim和PEP 8 - Python Code样式指南的推荐,我安装了vim-flake8(和vim-pathogen).当违反PEP8样式指南时,这会发出警告.这很棒,但我想在编辑python文件时首先自动扩展标签.我想在编辑其他类型的文件时让tab键实际插入标签.
换句话说,我想在编辑python文件和python文件时应用以下内容:
set expandtab " tabs are converted to spaces
set tabstop=4 " numbers of spaces of tab character
set shiftwidth=4 " numbers of spaces to (auto)indent
Run Code Online (Sandbox Code Playgroud)
Vla*_*ala 58
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4
Run Code Online (Sandbox Code Playgroud)
甚至更短:
au Filetype python setl et ts=4 sw=4
Run Code Online (Sandbox Code Playgroud)