[IPython-user] Beginner questions (mostly about history)
Ville M. Vainio
Wed Jun 6 10:59:38 CDT 2007
On 6/6/07, Gerhard Fiedler <firstname.lastname@example.org> wrote:
> I'm just starting to use IPython; I want to see how it works out as my main
> shell. (This is on WinXP.)
Cool. First of all, remember to launch IPython by "ipython -p sh" (or
use the 'pysh' start menu shortcut) to enjoy all the shell benefits
(they end up in 'sh' profile first).
> - I see that the command history is persistent between sessions, as I can
> recall past commands through the up arrow, even from past sessions. But I
> can't figure out how to list them; when I use %hist, I only get the
> commands from this session. Is there a way to list the commands from
> previous sessions also?
The up arrow gives you stuff from readline history, which don't end up
in the input history structure of IPython proper (they also don't have
an input history index number).
I have thought of a feature called "shadow history" that would have
every command ever executed, but only once. I'm not yet sure how to
refer to those history entries, Perhaps by octal-looking notation:
# fetch line 24
# fetch line 24 in shadow history
> - The directory history doesn't seem to be persistent between sessions, but
> I'd like it to be. Can this be done?
It can be done. I'll add it to the 'sh' profile.
%bookmark may also be handy for this, see '%bookmark?'.
> - There's a feature of the auto completion (of e.g. cd) that I'd like to
> port over from 4NT (that's the shell I'm using so far). When I type "cd
> foo<TAB>" in IPython, I get a list of every directory that starts with
> "foo" and I seem to have to type the remainder until I get to something
> unique. In 4NT, I can just continue to hit <TAB> and the directories at the
> command line cycle through the available options. (Works also with files
> where filename completion is done.) Is it possible to make this work
That's up to the readline configuration, but I don't know whether your
behaviour is supported. I certainly don't like the normal windows way,
and think this bash style completion is one of the good reasons to
switch to ipython for shell usage. You don't have to "type the
remainder to get something unique", just enter one letter and press
tab again to expand as much as can be expanded unambiguously...
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the IPython-user