免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6107 | 回复: 16
打印 上一主题 下一主题

求教用vim编辑python [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-14 14:27 |只看该作者 |倒序浏览
哪位大虾能给讲一下怎么把vim配置成一个适合编写python的编辑器?我在网上搜索,看到很多都是在windows下用vim的,按照那个设置,自己设置不好。

谁给讲讲在ubuntu下怎么配置vim,能够方便的写python程序?

我希望实现的功能如下:
1、tab的宽度是4个空格
2、最好能有自动缩进
3、自动补齐

其他就无所谓了。

论坛徽章:
0
2 [报告]
发表于 2010-05-14 15:51 |只看该作者
set autoindent        "always set autoindenting on
set smartindent       "set smart indent
set smarttab          "use tabs at the start of a line, spaces elsewhere
set expandtab         "not use tab
set tabstop=4 softtabstop=4 shiftwidth=4

再装上omni complete, pep8, pyflakes,够用。

论坛徽章:
0
3 [报告]
发表于 2010-05-14 16:14 |只看该作者
set autoindent        "always set autoindenting on
set smartindent       "set smart indent
set sma ...
23号 发表于 2010-05-14 15:51



多谢,我现在用的是下面这段内容,也能凑合。

  1. filetype indent on
  2. set smartindent
  3. set smarttab
  4. set expandtab
  5. set tabstop=4
  6. set softtabstop=4
  7. set shiftwidth=4

  8. " vim 自动补全 Python 代码
  9. " 来自http://vim.sourceforge.net/scripts/script.php?script_id=850
  10. autocmd FileType python set complete+=k~/.vim/tools/pydiction
复制代码

论坛徽章:
0
4 [报告]
发表于 2010-05-14 23:58 |只看该作者
,pydiction是个好东西

论坛徽章:
0
5 [报告]
发表于 2010-05-15 14:59 |只看该作者
新版 pydiction 好像不是这么用得了吧……

论坛徽章:
0
6 [报告]
发表于 2010-05-15 17:45 |只看该作者
Python Omni Completion: http://www.vim.org/scripts/script.php?script_id=1542 这个好用。

论坛徽章:
0
7 [报告]
发表于 2010-05-17 10:49 |只看该作者
Python Omni Completion:  这个好用。
23号 发表于 2010-05-15 17:45



怎么用?
我下载了这个文件,放到了~/.vim/autoload/  目录下,然后在~/.vimrc文件重增加:filetype plugin on

比如我输入
import sys, os
然后输入
os.
按什么键会补齐?ctrl+x或者ctrl+o?

论坛徽章:
0
8 [报告]
发表于 2010-05-17 11:26 |只看该作者
ctrl+x  + ctrl+o

论坛徽章:
2
午马
日期:2015-01-27 11:22:392015年辞旧岁徽章
日期:2015-03-03 16:54:15
9 [报告]
发表于 2010-05-18 20:21 |只看该作者
经常各种语言换着写,还是通用一点的就好了~

论坛徽章:
0
10 [报告]
发表于 2010-05-21 12:49 |只看该作者
emacs党飘过。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP