-
Notifications
You must be signed in to change notification settings - Fork 128
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
[suggestion] new default keybindings #103
Comments
I've been using something similar. I don't think I've got them quite perfected yet, but approaching something I'm happy with. I think mapping
|
Thanks. I've added that to my
|
I have pinned this issue and would welcome any suggestions or recommendations on keybindings. My intention is to make the default keybindings similar to those in VSCode, while also allowing for high customizability. |
Since you asked for suggestions, these are the keybindings I'm using: ;; Based on function from https://robert.kra.hn/posts/2023-02-22-copilot-emacs-setup/
(defun copilot-complete-or-accept ()
"Command that either triggers a completion or accepts one if one
is available."
(interactive)
(if (copilot--overlay-visible)
(progn
(copilot-accept-completion))
(copilot-complete)))
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
(define-key copilot-mode-map [C-down] #'copilot-next-completion)
(define-key copilot-mode-map [C-up] #'copilot-previous-completion)
(define-key copilot-mode-map [C-right] #'copilot-accept-completion-by-word)
(define-key copilot-mode-map [C-M-right] #'copilot-accept-completion-by-line)
(define-key global-map (kbd "C-<return>") #'copilot-complete-or-accept) Where copilot-complete-or-accept based on C-up and C-down are probably not so great for defaults because they don't work in terminal emacs without some manual configuration to make the terminal emulator send the right ANSI sequence. I personally use M-p and M-n for something else, but they are probably better for defaults. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Some keys working well for me in evil-mode: ;; Setup keys with copilot: |
It seems like multiple people here are suggesting fixes that bind to a broader keymap than |
I've also had this issue. I haven't got around to reporting to it because I was trying to get an idea about the problem first (e.g. whether it was something I'd misconfigured). The map isn't always active when the overlay is open, but I haven't been able to work out why not. |
Have you updated copilot? An issue like that was fixed a while ago. |
Yes, I'm running on the latest commit 9694981. |
To pile it on here (this is more of a dicussion thread), for evil-mode I've been using: ;; accept completion from copilot and fallback to company
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)
("M-n" . 'copilot-next-completion)
("M-p" . 'copilot-previous-completion)
)) This leaves |
I hope there aren't going to be automatically configured keybindings when this package loads, as that could conflict my configuration. |
I like when packages suggest keybindings that "just work". It makes packages more friendly to adopt. This package is especially tricky if you want to use tab complete for both company-mode (eglot) AND copilot. I wish there was a "blessed" example of how to tab complete both company-mode and copilot (i.e. mimic VS Code)—I tried for many hours but it's very finnicky to have the Tab key do multiple things, so I just decided to use M- for I do think packages that have default keybindings should clearly document that fact and provide a simple example of how to get rid of them. |
How would you make TAB do both? The only way I can see that working is if you intermingle the copilot completions with the company completions in the completion menu. |
Hey, I have been experimenting with these keybindings for a month or two and they rock 🎸. They're like Fish completion keybindings. They allow for more fine-grained completion and they don't collide with Corfu nor Company TAB/C-n/C-p/RET usage.
The text was updated successfully, but these errors were encountered: