9

I downloaded the Clojure jar. Its version is 1.6.0. When I run Clojure in console I press arrow keys but they don't move the cursor but produce these characters "[[D^[[C.

I start Clojure using this command:

java -cp clojure-1.6.0.jar clojure.main

using Java 1.7.0_55 64 bit on Ubuntu 14.04 LTS 64 bit.

How can I get back normal arrow keys behaviour ?

amalloy
  • 89,153
  • 8
  • 140
  • 205
michalskuza
  • 317
  • 4
  • 12
  • Just a pedantic note, this is not "normal arrow keys behavior", it is the behavior that the `readline` library and its various imitators implement. It isn't a property of the console, it is a property of some program using the console. Normal console behavior is to echo the representation of each key that comes in, which for arrow keys is the strange compound sequence you see here. – noisesmith May 29 '14 at 22:17

2 Answers2

20

The repl bundled with Clojure is pretty terrible. But that's okay, because you want to install Leiningen anyway, and its repl is much better, including the various readline stuff you're used to.

But in general, if there's some app that does a terrible job of being a repl, you can always use rlwrap to wrap the app in readline.

Community
  • 1
  • 1
amalloy
  • 89,153
  • 8
  • 140
  • 205
  • 1
    For reference, here is the [lein-cljsbuild wiki page on using Readline](https://github.com/emezeske/lein-cljsbuild/wiki/Using-Readline-with-REPLs-for-Better-Editing). – David J. Dec 06 '14 at 21:58
10

You are following hopelessly outdated instructions/tutorials. The generally accepted way to interact with all things clojure is through Leiningen. Then start Clojure by running:

lein repl

You can create a new web project by running:

lein new compojure my-project-name

or a new general project by running:

lein new my-project-name
guntbert
  • 536
  • 6
  • 19
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284