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

Typing a / should not move curosr to end of line #691

Open
bendavis78 opened this issue Dec 21, 2024 · 2 comments
Open

Typing a / should not move curosr to end of line #691

bendavis78 opened this issue Dec 21, 2024 · 2 comments
Labels

Comments

@bendavis78
Copy link

It's impossible to type a / char in the prompt when all you need is a literal /. For example:

Why am I showing high disk i/o when running this code?

Screencast.From.2024-12-20.21-40-10.mp4

Expected behavior
Is it possible to make it so that when you type / or some other autocomplete char, it doesn't force the cursor to the end of the line, allowing you to continue typing?

@tradiff
Copy link

tradiff commented Dec 22, 2024

I believe # has the same issue.

@guill
Copy link
Contributor

guill commented Dec 22, 2024

I believe this is the issue behind the following warning in the README:

If you are on neovim < 0.11.0, you also might want to add noinsert and popup to your completeopt to make the chat completion behave well.

There are three easy-ish ways to work around this yourself:

  1. Upgrade to NeoVim 0.11.0
  2. Make the changes recommended above globally (though this will change how completion works everywhere).
  3. Use a config function that looks something like this to automatically set these options only in Copilot buffers. (If you want one of these options to remain enabled everywhere, you'll have to change this code accordingly.)
        config = function(_, opts)
            require("CopilotChat").setup(opts)
            vim.api.nvim_create_autocmd('BufEnter', {
                pattern = "copilot-*",
                callback = function()
                    vim.opt.completeopt = vim.opt.completeopt + "noinsert" + "noselect"
                end
            })
            vim.api.nvim_create_autocmd('BufLeave', {
                pattern = "copilot-*",
                callback = function()
                    vim.opt.completeopt = vim.opt.completeopt - "noinsert" - "noselect"
                end
            })
        end,

It would definitely be nice if the plugin automatically did this for you when using 0.10.0 though. I can't imagine anyone actually wanting the current behavior.

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

No branches or pull requests

4 participants