CopilotC-Nvim / CopilotC-Nvim/CopilotChat.nvim

Make `M.chat:focus()` optional

Open
#1,464 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
3.7k
Forks
171
Avg merge
16h 26m
Merged PRs (30d)
1

Description

Hallo,

      {
        "<leader>ae",
        function()
          local copilot = require("CopilotChat")
          copilot.ask("Explain code underneath")
        end,
        desc = "Explain code underneath (CopilotChat)",
        mode = { "n", "v" },
      },

Consider this snippet as example, everything works fine, my last wish is that I don't want to focus copilot-chat window and for cursor to stay where it was before.

I think relevant line is here, but I don't fully understand logic behind checks if we are indeed in copilot-chat window and if I create flag and optionally disable vim.api.nvim_set_current_win(self.winnr) visual selection stops working.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lua/CopilotChat/ui/chat.lua around line 460 and trace the window-selection logic used by copilot.ask. Check how the proposed optional focus behavior interacts with visual selections, then verify that the cursor remains in its original window when focus is disabled while existing focus behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.