Quantcast
Channel: 笑遍世界 » eclipse
Viewing all articles
Browse latest Browse all 2

Python IDE —— Pydev的一些个性化设置

0
0

以前我用过eric做python的IDE,但用的不是很爽,然后也试图用Vim添加一些插件来做python的IDE,也没搞的很好,估计用户就是这样,初次看到或者使用的时候给用户造成了一些困难,就很可能让用户对这个产品丧失兴趣。当然我不是说eric、vim不好,相反,它们都有很多用它们来写Python的支持者,而且我写C或者Shell时都一般用Vim。后来,写Python时,我就用了Eclipse,加上个Pydev插件就可以写Python了,用了半年左右,感觉这个用起来还算比较顺手。

这几天刚好设置了一下Pydev,让其更有个性化和效率,现在简单列一下,也是为了自己下次重新设置它时更方便。

1. tab大小的设置:前一篇文章,说到过了,此处再说一下吧。window——preference——Pydev——Editor,即可看到Tab length的设置,另外就在其下面一行,有个选项,“Replace tabs with spaces when typing?”,如果选中它,那么你新建的源文件中就不存在tab符号了,而是用X个空格来代替的。

2. module开头的自动注释的设置:window——preference——Pydev——Editor–Templates,我是选择了对name为“<Empty>”的设置,并且将其表为“on”了。其设置的值如下:

View Code PYTHON
1
2
3
4
5
6
7
'''
Created on ${date}
 
@author: Jay Ren
@module: ${module}
'''
${cursor}

3. print的设置(由于我使用python3,所以为print ()):设置也是在templates那里,选择name为”print”的那一项,设置为:print${space_if_py2}${lparen_if_py3}${cursor}${rparen_if_py3}, 并且将其automatically insert选中。

4. 自动补全的设置:window——preference——Pydev——Editor–Code Completion 处进行一些个性化的设置。

设置好之后,一个简单效果如下:

View Code PYTHON
1
2
3
4
5
6
7
8
9
10
11
'''
Created on 2011-12-7
 
@author: Jay Ren
@module: just_for_fun
'''
def just_for_fun():
	print('just for fun')
 
if __name__ == '__main__':
	just_for_fun()

5. 设置PEP8代码风格检查:Window > Preferences > PyDev > Editor > Code Analysis > pep8.py 可以自己选择标志为Error还是Warning。 (PS: update于2015年,PEP8的检查蛮有用的,可以让代码看起来更干净、舒服。)

Original article: Python IDE —— Pydev的一些个性化设置

©2015 笑遍世界. All Rights Reserved.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images