python 一款神器:prompt-toolkit

2014 年 9 月 30 日
 cbsw
https://github.com/jonathanslenders/python-prompt-toolkit
一款python shell,目前尚处于开发状态,已有功能:输入时代码高亮,多行编辑,补全,Emacs/Vi 快捷键绑定等,还支持 ipython
10037 次点击
所在节点    Python
14 条回复
izoabr
2014 年 9 月 30 日
跟bpython那样?
tedd
2014 年 9 月 30 日
的确很棒,还支持vi binding
cchange
2014 年 9 月 30 日
赞 作为工具控一定得收藏并使用
hahastudio
2014 年 9 月 30 日
这个好
不过我已经快习惯 IPython notebook 了= =
sorcerer
2014 年 9 月 30 日
好东西 谢谢分享
fxbird
2014 年 10 月 1 日
用pychram就够用了,支持jetbrains
ericls
2014 年 10 月 1 日
@fxbird pycharm 是interpreter?
hatcloud
2014 年 10 月 1 日
安装完后运行ptpython没反应,刚学Python,不知道怎么弄
cha1
2014 年 10 月 1 日
@hatcloud
安装: $ pip install prompt-toolkit
运行: $ ptpython

------------------------------------------
如果不行的话,
1. 我这边的 ptpython是是在 /usr/local/bin/ptpython 中的, 可以看看有没有
2. find 或者 locate 看有没有ptpython这个文件. 建议: $ sudo updatedb; sudo locate ptpython (find 太慢了...)

------------------------------------------
另外, 如果输入多行语句的话 "Enter"键的作用是换行; "Alt+Enter"是执行
In [4]: if True: //这里按"Enter"键, 换行
2. print("Hello World!"); // 按"Alt+Enter", 执行
Hello World!

参考:
Multiline editing

Usually, multi-line editing mode will automatically turn on when you press enter after a colon, however you can always turn it on by pressing F7.

To execute the input in multi-line mode, you can either press Alt+Enter, or Esc followed by Enter. (If you want the first to work in the OS X terminal, you have to check the "Use option as meta key" checkbox in your terminal settings. For iTerm2, you have to check "Left option acts as +Esc" in the options.)
hatcloud
2014 年 10 月 1 日
@zqhong OK了,原来第一次没安装成功
kehr
2014 年 10 月 1 日
很赞的一款工具!
limbo0
2014 年 10 月 11 日
不错,多行编辑,补全 vi 哈哈
mulog
2014 年 10 月 14 日
试了一下 好用哭了 感谢分享
有时候就是想写几行试验一下 然后就是懒得开vi
于是就经常在py的控制台里写了一行十来行的function 最后发现打错一个字 然后重来。。
有了它 麻麻再也不用担心啦^_^
tolerious
2014 年 10 月 18 日
我觉得乖乖的用PyCharm挺好的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/136610

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX