Created
February 23, 2013 14:12
-
-
Save mdjhny/5019911 to your computer and use it in GitHub Desktop.
vim的python配置
即使配置如此 ,Python的缩进也并不是很理想。比较好的选择是再使用一个插件 hynek/vim-python-pep8-indent。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"自动缩进 | |
set autoindent | |
"类似C语言风格的缩进 | |
set cindent | |
"智能缩进:每一行都和前一行有相同的缩进量, | |
"同时这种缩进形式能正确的识别出花括号,当遇到右花括号(}), | |
"则取消缩进形式。此外还增加了识别C语言关键字的功能。 | |
"如果一行是以#开头的(比如宏),那么这种格式将会被特殊对待而不采用缩进格式 | |
set smartindent | |
"For Python Programmers | |
autocmd FileType python set textwidth=79 " PEP-8 Friendly | |
"把输入的tab自动转换成空格,Python用户必用~ | |
set expandtab | |
"一个tab键占据4个空格 | |
set tabstop=4 | |
"一开始,插入的就是4个空格,此时一旦你再按下一次tab,这次的四个空格就会和上次的四个空格组合起来变成一个制表符 | |
set softtabstop=4 | |
"每一级自动缩进的空格数 | |
set shiftwidth=4 | |
"根据文件类型设定缩进,覆盖掉默认的~ | |
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=79 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment