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

feat(session-manager): allow Ctrl n and Ctrl p in attach to session to navigate items #3321

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anopheles
Copy link

@anopheles anopheles commented May 3, 2024

Readlines, https://readline.kablamo.org/emacs.html, uses Ctrl + n/p to

Fetch the previous/next command from the history list.

Using this in the session manager is an obvious choice, especially as key mappings can't be configured.

Addresses #2740

Unfortunately, ctrl+hjkl doesn't seem to work in this context.

addresses zellij-org#2740

Unfortunately, ctrl+hjkl doesn't seem to work in this context.
@Zykino
Copy link
Contributor

Zykino commented May 3, 2024

Ctrl+p is already bind to start the pane mode -> This is a conflicting default keybindings.

Also, since all you change is in the config, feel free to fork the session-manager. I’m not sure exactly how to do it, but it should be possible to give the keybindings you want to use as configuration at load.

For an example on how to get the config see:

fn load(&mut self, configuration: BTreeMap<String, String>) {
self.is_welcome_screen = configuration
.get("welcome_screen")
.map(|v| v == "true")
.unwrap_or(false);

@anopheles
Copy link
Author

Ctrl+p is already bind to start the pane mode -> This is a conflicting default keybindings.

Good observation. The arrow keys, which the session manager currently uses for navigation, is also already used in various contexts. I therefore don't see it as a problem. If a user uses the session-manager all keys are handled by the plugin, until it exits (as far as I can tell).

Also, since all you change is in the config, feel free to fork the session-manager.

I hoped to merge this into the zellij main repository. As I expect the session-manager to evolve in the next couple of months, I am unable to invest capacity to keep my fork in sync.

For an example on how to get the config see:

Thanks! I'll see what I can do.

Disclaimer: This is my first XP with rust :)

@anopheles
Copy link
Author

anopheles commented May 6, 2024

Does someone have any pointers to due something like this in the plugin section?

session-manager location="zellij:session-manager" {
        bind "Ctrl n" { MoveSelectionUp; }
        bind "Ctrl p" { MoveSelectionDown; }
    }

configuration: BTreeMap<String, String> only seems to store string values.

Or what would be your preferred implementation strategy here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants