Menu

#32 An extension to add command-wise navigation to the shell

open
nobody
None
5
2003-01-23
2003-01-23
No

This extension enables navigating in the shell window
according to
Python commands, using the Alt key.
Alt+Home goes to the beginning of the current command.
Alt+End goes to the end of the current command.
Alt+Up goes the the previous command.
Alt+Down goes to the next command.

This is, from my experience, useful for two things:
1. Many times, you want to recall a previous command. I
think it is easier to do so in the context of its
output and other commands, so instead of pressing
alt+p, which brings all commands but leaves them out of
context, you do alt+up to move quickly to the place
where you used the command, and then you click enter.
2. if you want to delete the entire command you typed,
especially if it contains multiple lines, you can now
type alt+shift+home, to move to the beginning of the
command while selecting the area, and press delete. I
don't know of an easy way to do this previously.

I wrote this as an extension, but I think the four
events should go directly to the PyShell class. I think
doing that is quite easy.

I don't see a way to attach two files, and I don't want
to bother you with another update, so you should add
the attached file to the directory of IDLEfork, and add
the following to config-extensions.def:

[CommandNavigator]
enable=1
[CommandNavigator_bindings]
beg_of_command=<Alt-Key-Home>
end_of_command=<Alt-Key-End>
prev_command=<Alt-Key-Up>
next_command=<Alt-Key-Down>

Discussion

  • Noam Yorav-Raphael

    The module which is the IDLE extension

     
  • Noam Yorav-Raphael

    Logged In: YES
    user_id=679426

    I'm sorry, from some reason the file wasn't uploaded

     
  • Noam Yorav-Raphael

    Logged In: YES
    user_id=679426

    I add context diff files for integrating the command-wise
    navigation into PyShell, instead of being an extension.
    I deleted the event beginning-of-line, which caused the
    cursor to go to after the >>> instead of to the real
    beginning of line, since now Alt-Home has the same
    behaviour, so a special behaviour for the home key on the
    first line of the command edited is unneccesary. Also, there
    was a bug with this event - it didn't work when the Num Lock
    key was on. It is fixed in the new Alt-Home event.

     
  • Noam Yorav-Raphael

     
  • Noam Yorav-Raphael

     
  • Noam Yorav-Raphael

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.