Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command history in Interactive Window #8658

Closed
leifwalsh opened this issue Jan 7, 2022 · 6 comments
Closed

Command history in Interactive Window #8658

leifwalsh opened this issue Jan 7, 2022 · 6 comments
Assignees
Labels
interactive-window Impacts interactive window

Comments

@leifwalsh
Copy link

When using the Interactive Window, I'd like to be able to reuse previous inputs, like I'd do in a shell like bash or a command line Python or IPython REPL, so I can rerun previous input cells, or edit them slightly before running again.

I'd like to be able to access these with keyboard shortcuts that are familiar to how I use interactive shells in a terminal, so I'd expect something close to readline support (up/down arrow keys to go back and forward in command history, Ctrl-P/Ctrl-N if I'm using Emacs keybindings, or j/k if I'm using Vim keybindings). Even better would be command search like Ctrl-R for searching backwards through history. See https://readline.kablamo.org/emacs.html for inspiration too.

It might also be interesting to be able to navigate through the output window above the prompt, maybe as something like a read-only buffer, but one where you can select and copy previous inputs (or maybe also outputs) from it. Again, ideally accessible only via keyboard shortcuts, for people who try to avoid the mouse :)

@amunger
Copy link
Contributor

amunger commented Jan 7, 2022

Thanks for the suggestion.
Using the up/down keys in the Interactive Window's input box currently navigates through previously run commands, but only if they were run in the input box - Are you suggesting that cells run from the .py file should also be included in that list?

@amunger amunger added the interactive-window Impacts interactive window label Jan 7, 2022
@amunger
Copy link
Contributor

amunger commented Jan 7, 2022

Also, take a look at #4716 which I think covers part of what you're looking for.

@leifwalsh
Copy link
Author

Hmm, up/down doesn't do that for me, but it could be my keybinding extension (tuttieee.emacs-mcx) getting in the way. I'll try disabling it and poking around.

#4716 does cover the readline stuff I was talking about, and the rest of this issue is just a problem with my installation, so let's close this. Thanks for the quick answer!

@leifwalsh
Copy link
Author

Yeah, adding a new C-p and C-n keybinding to interactive.history.{next,previous} helped, but I'm not sure what was capturing that before.

@kjohnsen
Copy link

kjohnsen commented Jul 6, 2022

This is broken for me when using Vim. I'd like to be able to use K and J like up and down to access previously run input boxes, but it doesn't work. Maybe because I have K and J mapped to g-k and g-j (for navigating on wrapped lines)

@amunger
Copy link
Contributor

amunger commented Jul 6, 2022

@kjohnsen can you open a new issue for what you're seeing and those specific settings

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
interactive-window Impacts interactive window
Projects
None yet
Development

No branches or pull requests

3 participants