feat: add copilot and magit to emacs

trying out copilot, hopefully it's gonna surprise me
This commit is contained in:
jabuxas 2025-02-12 08:27:56 -03:00
parent ddb1d86a7f
commit d9c3650e4a
3 changed files with 32 additions and 1 deletions

View File

@ -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
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . '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 <tab> in Evil's insert state
(evil-define-key 'insert 'global (kbd "<tab>") 'my/copilot-tab-or-default))

View File

@ -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

View File

@ -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")))