mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
feat(completion/copilot): add new and improve existing keybindings
This commit is contained in:
@@ -13,21 +13,45 @@
|
||||
(prog-mode . copilot-mode)
|
||||
|
||||
:general
|
||||
("C-<tab>" 'copilot-accept-completion)
|
||||
("<backtab>" 'copilot-accept-completion)
|
||||
(:keymaps 'company-active-map
|
||||
"C-<tab>" 'copilot-accept-completion
|
||||
"C-TAB" 'copilot-accept-completion
|
||||
"<backtab>" 'copilot-accept-completion)
|
||||
("C-<tab>" 'siren-copilot-accept-completion-dwim)
|
||||
("<backtab>" 'siren-copilot-accept-completion-dwim)
|
||||
("M-F" 'siren-copilot-accept-completion-by-word-dwim)
|
||||
("M-E" 'siren-copilot-accept-completion-by-line-dwim)
|
||||
(:keymaps 'copilot-completion-map
|
||||
"M-N" 'copilot-next-completion
|
||||
"M-P" 'copilot-previous-completion)
|
||||
|
||||
:preface
|
||||
(defun siren-copilot-accept-completion-dwim ()
|
||||
"Accept the current completion or trigger copilot-compilot."
|
||||
(interactive)
|
||||
(siren-copilot-complete-or-call 'copilot-accept-completion))
|
||||
|
||||
(defun siren-copilot-accept-completion-by-word-dwim ()
|
||||
"Accept the current completion by word, or trigger copilot-compilot."
|
||||
(interactive)
|
||||
(siren-copilot-complete-or-call 'copilot-accept-completion-by-word 1))
|
||||
|
||||
(defun siren-copilot-accept-completion-by-line-dwim ()
|
||||
"Accept the current completion by word, or trigger copilot-compilot."
|
||||
(interactive)
|
||||
(siren-copilot-complete-or-call 'copilot-accept-completion-by-line 1))
|
||||
|
||||
(defun siren-copilot-complete-or-call (f &rest args)
|
||||
"Trigger copilot-complete or call F."
|
||||
(if (copilot-current-completion)
|
||||
(apply f args)
|
||||
(copilot-complete)))
|
||||
|
||||
:config
|
||||
(with-eval-after-load 'company
|
||||
;; Use company popup even when there's only one result
|
||||
(delq 'company-preview-if-just-one-frontend company-frontends)
|
||||
(setf (nth (position 'company-pseudo-tooltip-unless-just-one-frontend
|
||||
company-frontends)
|
||||
company-frontends)
|
||||
'company-pseudo-tooltip-frontend)))
|
||||
(when (member 'company-preview-if-just-one-frontend company-frontends)
|
||||
(delq 'company-preview-if-just-one-frontend company-frontends)
|
||||
(setf (nth (position 'company-pseudo-tooltip-unless-just-one-frontend
|
||||
company-frontends)
|
||||
company-frontends)
|
||||
'company-pseudo-tooltip-frontend))))
|
||||
|
||||
(provide 'siren-copilot)
|
||||
;;; siren-copilot.el ends here
|
||||
|
||||
Reference in New Issue
Block a user