diff --git a/desktop/configs/doom/.config/doom/config.el b/desktop/configs/doom/.config/doom/config.el index aa58f99..9897fb7 100644 --- a/desktop/configs/doom/.config/doom/config.el +++ b/desktop/configs/doom/.config/doom/config.el @@ -169,3 +169,31 @@ (map! :leader :desc "Search by grep" ; This description shows in which-key popups "r g" #'consult-ripgrep) + +;; accept completion from copilot and fallback to company +(use-package! copilot + :hook (prog-mode . copilot-mode) + :bind (:map copilot-completion-map + ("" . 'copilot-accept-completion) + ("TAB" . 'copilot-accept-completion) + ("C-TAB" . 'copilot-accept-completion-by-word) + ("C-" . 'copilot-accept-completion-by-word)) + :config + (add-to-list 'copilot-indentation-alist '(prog-mode 2)) + (add-to-list 'copilot-indentation-alist '(org-mode 2)) + (add-to-list 'copilot-indentation-alist '(text-mode 2)) + (add-to-list 'copilot-indentation-alist '(closure-mode 2)) + (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2))) + +(after! (evil copilot) + ;; Define the custom function that either accepts the completion or does the default behavior + (defun my/copilot-tab-or-default () + (interactive) + (if (and (bound-and-true-p copilot-mode) + ;; Add any other conditions to check for active copilot suggestions if necessary + ) + (copilot-accept-completion) + (evil-insert 1))) ; Default action to insert a tab. Adjust as needed. + + ;; Bind the custom function to in Evil's insert state + (evil-define-key 'insert 'global (kbd "") 'my/copilot-tab-or-default)) diff --git a/desktop/configs/doom/.config/doom/init.el b/desktop/configs/doom/.config/doom/init.el index 0ed38bf..32bfa3a 100644 --- a/desktop/configs/doom/.config/doom/init.el +++ b/desktop/configs/doom/.config/doom/init.el @@ -97,7 +97,7 @@ (eval +overlay) ; run code, run (also, repls) lookup ; navigate your code and its documentation lsp ; M-x vscode - ;;magit ; a git porcelain for Emacs + magit ; a git porcelain for Emacs make ; run make tasks from Emacs ;;pass ; password manager for nerds pdf ; pdf enhancements diff --git a/desktop/configs/doom/.config/doom/packages.el b/desktop/configs/doom/.config/doom/packages.el index 364e6e9..2c32516 100644 --- a/desktop/configs/doom/.config/doom/packages.el +++ b/desktop/configs/doom/.config/doom/packages.el @@ -48,3 +48,6 @@ ;; (unpin! pinned-package another-pinned-package) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;; (unpin! t) + +(package! copilot + :recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el")))