Re: [R] R command history -- can it be like Matlab's?

From: hadley wickham <h.wickham_at_gmail.com>
Date: Tue, 29 Jul 2008 16:59:12 -0500

On Tue, Jul 29, 2008 at 4:39 PM, Rolf Turner <r.turner_at_auckland.ac.nz> wrote:
>
> On 30/07/2008, at 9:16 AM, hadley wickham wrote:
>
>> On Tue, Jul 29, 2008 at 2:45 PM, Prof Brian Ripley
>> <ripley_at_stats.ox.ac.uk> wrote:
>>>
>>> A patch to do this was posted on 2007-09-29 by Glenn Davis. Some people
>>> not
>>> addicted to Matlab find the behaviour very inconvenient and prefer the
>>> getline/readline behaviour (triggered by ^R/^S) of Rterm and R on Unixen.
>>
>> On unixen you can redefine your up/down arrows in your .inputrc:
>>
>> "\e[A": history-search-backward
>> "\e[B": history-search-forward
>>
>> which I find really useful, but it definitely takes a few weeks of
>> getting used to. I suspect there maybe an equivalent for Rterm.
>
> Those of us who (sensibly! :-) ) use vi have:
>
> set editing-mode vi
>
> in our .inputrc files.
>
> Then <esc> puts you into vi editing mode whence ``/'' searches
> ``forwards'' and ``?'' searches ``backwards'' --- with the convention
> that the most recent command is the ``top'' of the file.
>
> And then when you've found the command that you want, you can edit it
> (with vi syntax) before pressing <return> to re-issue the command.

And you might also want to beef up the size of your history file (and automatically remove duplicates). I have the following in my bash_profile (and I assume similar functionality exists for other shells):

export HISTSIZE=1000
export HISTFILESIZE=5000
export HISTCONTROL=erasedups

Hadley

-- 
http://had.co.nz/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 29 Jul 2008 - 22:05:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 22:32:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive