适合Python程序员的vim配置文件

转载自[url]http://py.vaults.ca/~x/python_and_vim.html[/url]

paste into your ~/.vimrc

[quote]set tabstop=4 " A four-space tab indent width is the prefered coding style
" for Python (and everything else!), although of course some
" disagree. This page generally assumes you want 4-space
" indents.

set shiftwidth=4 " This allows you to use the < and > keys from VIM's visual
" (marking) mode to block indent/unindent regions

set smarttab " Use the "shiftwidth" setting for inserting <TAB>s instead
" of the "tabstop" setting, when at the beginning of a
" line. This may be redundant for most people, but some
" poeple like to keep their tabstop=8 for compatability
" when loading files, but setting shiftwidth=4 for nicer
" coding style.

set expandtab " expandtab et Insert spaces instead of <TAB>
" character when the <TAB> key is pressed. This is also
" the prefered method of Python coding, since Python is
" especially sensitive to problems with indenting which can
" occur when people load files in different editors with
" different tab settings, and also cutting and pasting
" between applications (ie email/news for example) can
" result in problems. It is safer and more portable to
" use spaces for indenting.

set softtabstop=4 " softtabstop=4 sts People like using real tab
" character instead of spaces because it makes it easier
" when pressing BACKSPACE or DELETE, since if the indent
" is using spaces it will take 4 keystrokes to delete
" the indent. Using this setting, however, makes VIM see
" multiple space characters as tabstops, and so <BS> does
" the right thing and will delete four spaces (assuming
" 4 is your setting).

set autoindent " autoindent ai Very painful to live without this
" (especially with Python)! It means that when you press
" RETURN and a new line is created, the indent of the new
" line will match that of the previous line.
[/quote]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值