如何将 TextMate 中的一行发送到在终端窗口中运行的 irb 进程?
我经常在打开 TextMate 窗口并在其旁边的终端窗口中运行 irb 进程的情况下进行编码。我希望能够在 TextMate 中按下一个按键序列,该序列执行以下操作:
- 复制当前选择,或者如果没有,则复制当前行。
- 将其粘贴到运行 irb 的最上面的终端窗口中。
- 按 Enter 键,以便在 irb 窗口中执行该行代码。
我在 R 中编码时使用了这种交互式开发风格,发现它非常方便。我很确定 emacs 和 SLIME 也可以让你像这样工作。 Ruby 和 TextMate 可以吗?
I often code with a TextMate window open, and an irb process in a Terminal window adjacent to it. I want to be able to press a key sequence in TextMate which does the following:
- Copies the current selection, or if there is none, the current line.
- Pastes it in the topmost Terminal window that is running irb.
- Presses enter so that the line of code is executed in the irb window.
I used this style of interactive development when coding in R and found it very convenient. I'm pretty sure emacs and SLIME also lets you work like this. Is it possible with Ruby and TextMate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须创建捆绑命令和键盘快捷键才能执行此操作。
观察“Hello World”命令 :
You must create a Bundle Command and a keyboard shortcut to do this.
The command:
假设您不想查看终端,而是希望结果显示在 TextMate 中,就像在 Smalltalk 工作区中一样。
本质上,您希望在文本配合中运行 ruby,但希望在执行之间记住变量。你可以拥有那个。
(感谢 stef 有关如何添加新命令的说明)
gem install daemons
@@hi = "Hello World"
和@@hi + "ya"
的新文档:命令
:
Suppose you don't want to look over at the Terminal, but instead want the result to show up in TextMate, like in a Smalltalk workspace.
In essence, you want to run ruby within text mate, but you want variables to be remembered between executions. You can have that.
(Thanks stef for instructions on how to add a new command)
gem install daemons
@@hi = "Hello World"
and@@hi + "ya"
The irb server:
The command: