[ESS] is it possible to change the history keys

Tyler Smith tyler.smith at mail.mcgill.ca
Fri Jan 4 22:55:44 CET 2008

On 2008-01-04, <markleeds at verizon.net> <markleeds at verizon.net> wrote:
> I just started using ESS ( thanks to Sundar and Spencer for helping
> me to get started ) and it's really great but I just had a question
> about the history keys.
> I have zero understanding of lisp but is it possible to put code in
> my init.el file so that my history keys are the up and and down
> arrow keys rather than esc p and esc n ? I have always had the
> history keys as the arrow keys and I'm finding it difficult to lose
> that habit so I was hoping to trick ESS so that my brain doesn't
> have to be reprogrammed. Thanks.

What OS are you using? It's certainly possible to do what you ask.
However, I like using up and down to move the cursor in the buffer,
and the default settings on my system (Debian GNU/Linux) have
Control-up and Control-down bound to the history commands. That's much
better than esc-p and esc-n for me. Also, on PC keyboards, alt and esc
do the same thing, except that you have to hold down the alt key. So
alt-p and alt-n should also work for you.

If you remain unconvinced, I think this will work for you:

(defun my-ess-mode-hook ()
  (local-set-key [up] 'comint-previous-input)
  (local-set-key [down] 'comint-previous-input))

(add-hook 'ess-mode-hook 'my-ess-mode-hook)



More information about the ESS-help mailing list