Skip to content

Conversation

@DamianB-BitFlipper
Copy link
Contributor

@DamianB-BitFlipper DamianB-BitFlipper commented Jan 20, 2026

Summary

  • Add session_last keybinding (<leader>o / ctrl-x o) to quickly switch to the previously viewed session
  • Track previous session ID in route context (ephemeral, in-memory)
  • Similar to Emacs's C-x o for switching windows

Closes #9526

Changes

  • packages/opencode/src/config/config.ts - Add session_last keybinding definition
  • packages/opencode/src/cli/cmd/tui/context/route.tsx - Track previous session ID
  • packages/opencode/src/cli/cmd/tui/app.tsx - Add "Switch to last session" command
  • packages/web/src/content/docs/keybinds.mdx - Document the new keybinding
  • packages/sdk/js/src/v2/gen/types.gen.ts - Regenerated SDK types

Add ability to quickly switch back to the previously viewed session
using ctrl-x o (leader + o). This is an ephemeral in-memory feature
similar to Emacs's C-x o for switching windows.

- Add session_last keybinding in config
- Track previous session ID in route context
- Add 'Switch to last session' command
- Update keybinds documentation
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@JosXa
Copy link
Contributor

JosXa commented Jan 20, 2026

Hmm... but if I have 3 or more sessions I wanna cycle between? Do you always work with exactly 2 for some reason? I regularly have 8 to 10 parallel sessions running - admittedly only the top 4 or so are actually active - but it still seems a little limiting to only be able to toggle between the two most recently viewed ones 🤔

@DamianB-BitFlipper
Copy link
Contributor Author

Let's get the core team to comment on this. For the N sessions use case, I think the existing "list sessions" is the best interface. If one has two sessions, which is typical for me at least because multitasking is hard, having the fast C-x o is useful.

Copy link

@mdsiaofficial mdsiaofficial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feat is needed. good

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.

feat: add keybinding to switch to last session

3 participants