带有命令行历史记录和制表符补全的mit-scheme REPL [英] mit-scheme REPL with command line history and tab completion

查看:66
本文介绍了带有命令行历史记录和制表符补全的mit-scheme REPL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 SICP ,并且我正在使用 mit-scheme 通过

I'm reading SICP and I'm using mit-scheme installed on my os x 10.8 laptop via homebrew.

一切工作都与广告宣传的一样,但是我对在REPL的Python和Node.js等运行时获得制表符完成和命令行历史记录的便捷性感到迷恋.

Everything works as advertised, however I'm spoiled by the ease with which I get tab completion and command line history in REPL's for runtimes like Python and Node.js.

我并没有寻找任何繁重的任务,但是这些功能在现代REPL中很容易实现(只是在Node中的几行.js ).

I'm not looking for anything heavy duty, but these features are pretty easy to come by in modern REPL's (it's just a simple startup file in Python and can be implemented in a few lines in Node.js).

是否有一种简便的方法可以在mit-scheme REPL中获得制表符完成和命令历史记录,而无需重型应用程序或无需切换到emacs(即在xterm终端中)?

Is there an easy way to get tab completion and command history in the mit-scheme REPL without a heavy-duty application or having to switch to emacs (i.e. in an xterm terminal)?

推荐答案

安装 readline包装器:

brew install rlwrap

安装后,rlwrap scheme将为您提供持久的历史记录,paren匹配和制表符补全.我通常将rlwrap与以下参数一起使用:

Once installed, rlwrap scheme will give you persistent history, paren matching, and tab completion. I typically use rlwrap with the following arguments:

-r将所有看到的单词放在in上并在完成列表上输出.

-r Put all words seen on in- and output on the completion list.

-c完整文件名

-f指定用于制表符补全的单词列表.我正在使用来自《 MIT计划参考手册》 . 您可以在此要点中找到它,而不是在此处重新发布该列表. 我已将此文件存储在"$ HOME"/scheme_completion.txt

-f Specify a list of words to use for tab completion. I'm using an abridged list of bindings from the MIT Scheme Reference Manual. Rather than republish the list here, you can find it in this gist. I have this file stored in "$HOME"/scheme_completion.txt

rlwrap -r -c -f "$HOME"/scheme_completion.txt scheme

1 ]=> (flo:a <tab tab>
flo:abs    flo:acos   flo:asin   flo:atan   flo:atan2  
1 ]=> (flo:abs -42.0)

;Value: 42.

这篇关于带有命令行历史记录和制表符补全的mit-scheme REPL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆