Enabling Emacs keybindings in the Racket REPL
When using Racket REPL, it is convenient to be able to use familiar keyboard shortcuts that are the same as those used in Bash and Emacs. Readline is responsible for the Emacs-like keybindings. By default, the Racket REPL does not enable readline support. You need to explicitly enable it. Enabling readline support will allow the use of keyboard shortcuts such as Ctrl + a for moving to the start of the line, Ctrl + e for moving to the end of the line, Ctrl + k to cut, etc.
To enable readline support, you can start the REPL using racket -il readline
, or if you want racket
to use readline every time it starts, create a .racketrc
file in your home directory (i.e. ~/.racketrc
), and add (require readline)
into it:
;; ~/.racketrc ;; Enable readline in the REPL. (require readline)
That is it. You can now use Emacs keybindings in the Racket REPL. If you prefer vi (or vim) keybindings instead, you will have to look for third-party packages, because the readline support in Racket only supports Emacs keybindings.