vim 中的 python 个文件中的缩进标签
Tabs for indentation in python files in vim
我正在尝试让 vim 对 python 文件使用制表符进行缩进。我不想讨论制表符与空格的优点,我只想要制表符。在我的 vimrc 中,我不仅有
set shiftwidth=4
set tabstop
但我也有一些 python 特定设置:
augroup python_files
autocmd!
autocmd FileType python setlocal noexpandtab
autocmd FileType Python set tabstop=4
autocmd FileType Python set shiftwidth=4
augroup END
这似乎应该在 python 文件中正确设置我的缩进设置,但是当我打开一个文件时,它显示文字制表符为 8 个字符宽,并且 TAB 键插入 4 个空格。我还可以在这里做些什么吗?
我刚刚弄明白了。在我的 augroup
中,我在 Python 中使用了大写的“P”,而它应该是小写的。以下完美运行:
augroup python_files
autocmd!
autocmd FileType python setlocal noexpandtab
autocmd FileType python set tabstop=4
autocmd FileType python set shiftwidth=4
augroup END
我正在尝试让 vim 对 python 文件使用制表符进行缩进。我不想讨论制表符与空格的优点,我只想要制表符。在我的 vimrc 中,我不仅有
set shiftwidth=4
set tabstop
但我也有一些 python 特定设置:
augroup python_files
autocmd!
autocmd FileType python setlocal noexpandtab
autocmd FileType Python set tabstop=4
autocmd FileType Python set shiftwidth=4
augroup END
这似乎应该在 python 文件中正确设置我的缩进设置,但是当我打开一个文件时,它显示文字制表符为 8 个字符宽,并且 TAB 键插入 4 个空格。我还可以在这里做些什么吗?
我刚刚弄明白了。在我的 augroup
中,我在 Python 中使用了大写的“P”,而它应该是小写的。以下完美运行:
augroup python_files
autocmd!
autocmd FileType python setlocal noexpandtab
autocmd FileType python set tabstop=4
autocmd FileType python set shiftwidth=4
augroup END