I've been trying out OCaml. Sometimes its quicker just to test out some code using the interpreter shell but, it doesn't bring up the last command when I press the 'up' key.
Its a pain when I miss type something or wish to see what a little variation would produce.
Anyone know if there is another key for it?
Thanks,
Answer #3:Alt + p for previous command from histroy, Alt + n for next command from history. This is default configure, and you can change these key shortcut at your preference from Options -> Configure IDLE.
Adapt yourself to IDLE: Insted of hitting the up arrow to bring back a previous command, if you just put your cursor on the previous command you want to repeat and then press "enter", that command will be repeated at the current command prompt. Press enter again, and the command gets executed.
Recalling Python code Lines of code executed in previous lines can be recalled using the up and down arrow keys. This recall inserts the specified line at the current command prompt location.
Use rlwrap
:
rlwrap ocaml
ocaml
itself has no readline support.
You can configure readline using ~/.inputrc
.
For example, you could add such lines to it:
$if ocaml
"\C-o": "()\C-b"
"\C-n": ";;\n"
$endif
Now you can use ctrl-o
and ctrl-n
hotkeys in ocaml
. Just try it.
You can use the improved toplevel utop. Moreover, it includes nice completion capacities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With