Standard ML repeats the last command, left arrow?

I am learning standard ML using its interpreter. Sometimes I make a typo and just want to repeat the previous command like in the Linux shell. However, the up arrow will end up printing special characters on the screen. Sometimes I want to go back to the left to fix something, the left arrow also prints special characters.

Does anyone know how to make them right?

+3


source to share


3 answers


I'm using Moscow ML, but I believe the answer will apply to whatever version you use:

You can achieve what you want using rlwrap

.

I have the following alias in mine .zshrc

which handles it automatically:



alias mosml="rlwrap mosml"

      

(Replace mosml

with the name of your SML interpreter.)

+7


source


Consider using the ledit program. It allows you to use the arrow keys to view previous commands.

Example:



ledit mosml

      

+2


source


If you are going to seriously hack SML, I highly recommend that you use a development environment that allows you to interact with the SML top-level environment.

I am using Emacs with SML mode . The beauty here is that in the top window, you can code functions and save them to a file. Then you can send them to the bottom window which contains the Inferior-SML process to compile. Also the Inferior-SML process has a default command history.

0


source







All Articles