Skip to content

<leader>oi cannot accumulate selections across files #248

Closed

Description

@jensenojs

Problem

The current <leader>oi behavior has two issues that prevent accumulating selections across files:

  1. Selections are cleared when switching files - After selecting content in File A, switching to File B clears the previous selection
  2. Cannot add selections when panel is already open - When the panel is open, selecting content in another file and pressing <leader>oi has no effect

Reproduction

  1. Open File A, select some code, press <leader>oi to add to context
  2. Switch to File B, select another piece of code
  3. Press <leader>oi - expected to add File B's selection to context, but:
    • Issue 1: If panel is not open, File A's selection is already cleared
    • Issue 2: If panel is already open, nothing happens

Expected Behavior

Allow accumulating selections across files, supporting selection in any buffer and adding to the existing selection set, with selections persisting throughout the session lifecycle.

Proposed Solution

  1. New API: context.add_visual_selection() - Only adds the current visual selection without clearing existing selections
  2. Bug fix: Modify debounced_load() to append selections instead of replacing them
  3. New keymap: <leader>oa (add selection) specifically for adding selections, separating the responsibility from <leader>oi (open input)

This allows <leader>oa to add selections from any buffer at any time without interfering with the normal <leader>oi workflow.

Activity

  1. sudo-tee commented on Feb 7, 2026

    @sudo-tee
    Owner

    Great suggestion.

    The selection was coupled to the current file in the past. Now it is not anymore, it will be a good opportunity to revise the way it works.

  2. sudo-tee commented on Feb 11, 2026

    @sudo-tee
    Owner

    @jensenojs

    I created a MR that would solve both of your concerns
    #261

    The shortcut to add selection is <leader>oy or the command Opencode add_visual_selection

    Let me know it it works for you

  3. added 6 commits that reference this issue on Feb 11, 2026
    2e14a9a
    84668dc
    d2d320f
    630e325
    9f048a7
    3ef4e8d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions