       if @inputFromUser and (@preventUserInput or point.column < @prompt.length or point.row < @editor.getLastBufferRow())
         event.cancel()
 
+    # Set up up/down arrow previous command cycling
+    @subs.add atom.commands.add @editorElement, 'core:move-up': (event) =>
+      @cycleBack()
+      event.stopImmediatePropagation()
+    @subs.add atom.commands.add @editorElement, 'core:move-down': (event) =>
+      @cycleForward()
+      event.stopImmediatePropagation()
+
+
     @subs.add @editor.onDidDestroy =>
       @closeRepl()
 

    @subs.add atom.commands.add @editorElement, 'editor:newline': (event) => @handleEnter(event)
    @subs.add atom.commands.add @editorElement, 'editor:newline-below': (event) => @handleEnter(event)



    @subs.add @editor.onWillInsertText (event) =>
      #console.log 'Insert: ' + event.text
      # console.log "Insert: #{event.text}"

  prompt: "> "
  preventUserInput: false
  inputFromUser: true
  # Keep track of command history, for use with the up/down arrows
  previousCommands: []
  cycleIndex: null

  constructor: (@swank) ->
    @prompt = @pkg + "> "
