使用SublimeREPL和Sublime Text 2将文本发送到REPL [英] Send Text to REPL Using SublimeREPL and Sublime Text 2
问题描述
我在开始使用SublimeREPL时遇到麻烦.我有一个python程序,可以在SublimeText2内部启动python解释器.
I'm having trouble getting started with SublimeREPL. I have a python program, and can start a python interpreter inside of SublimeText2.
但是,我想使用在副本中评估"和转移到副本"功能,但它们似乎无能为力.我如何将一个repl与我的崇高文字2中的文件相关联,以便它们可以正常工作?
However, I would like to use either the Eval In Repl and Transfer to Repl features, but they don't seem to do anything. How do I associate a repl with my file in sublime text 2 so these will work?
推荐答案
历史记录
说实话,对于python而言,eval从来没有可靠地工作过.它受到奇怪的编译错误(主要是由空格/空白行引起)的困扰,并且在评估过程中出现了许多不必要的">>>"提示.
History
To be honest eval for python never worked reliably. It was plagued with strange compilation errors (mainly caused by whitespace/blank lines) and dozens of unnecessary ">>> " prompts showing up during evaluation.
我使用临时文件修复它的尝试仅获得了一定程度的成功,并且由于能够通过ssh运行远程Python而彻底失败: http://www.youtube.com/watch?v=zodAqBvKQm0
My attempt to fix it using temporary files was only moderately successful and broke down completely with the ability to run remote Pythons over ssh: http://www.youtube.com/watch?v=zodAqBvKQm0
但是,看来我终于破解了它:)(一个令人惊讶的简短解决方案,让人感觉很棘手,但AFAICT应该比上一个更可靠,请好奇链接:
However it seems that I've finally cracked it :) (with a surprisingly short solution that feels hacky but AFAICT should be orders of magnitude more reliable than the previous one, link for the curious: https://github.com/wuub/SublimeREPL/blob/master/text_transfer.py#L43)
- 安装SublimeREPL 1.2.0(在10分钟前发布)
- 运行Python REPL(任意一个,不带virtualenv)
- 关注您要评估的文件
-
Tools -> SublimeREPL -> Eval in REPL -> File
或[Ctrl+, f]
- 使用其他选项(行评估应该很有用,您希望评估的每一行只需要一个光标,请尝试
[Ctrl+Alt+<down-arrow>]
) - ...
- 利润! :)
- Install SublimeREPL 1.2.0 (released +- 10 minutes ago)
- Run Python REPL (any one you wish, w/ or w/o virtualenv)
- Focus a file you wish to evaluate
Tools -> SublimeREPL -> Eval in REPL -> File
or[Ctrl+, f]
- Play with other options (line evaluation should be useful, you only need one cursor in each line you wish to eval, try
[Ctrl+Alt+<down-arrow>]
) - ...
- Profit! :)
这篇关于使用SublimeREPL和Sublime Text 2将文本发送到REPL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!