Compare commits

..

3 Commits

Author SHA1 Message Date
kj
709ca7fe27 Improvements to autocompletion with eglot.
Add a function to toggle autocompletion and improve the
competion-at-point-functions when eglot is rinning using cape-capf-super.
2025-09-01 12:35:10 -03:00
kj
a6b197b6a4 Add copilot toggle to hydra Toggles. 2025-09-01 11:56:03 -03:00
kj
021e19fb3c Add copilot package.
It is disabled by default but can be enabled if necessary.
2025-09-01 11:53:00 -03:00
6 changed files with 35 additions and 9 deletions

View File

@ -41,5 +41,12 @@
) )
) )
(use-package copilot
:bind (("M-<return>" . copilot-complete)
:map copilot-completion-map
("C-g" . 'copilot-clear-overlay)
("C-<return>" . 'copilot-accept-completion)
("C-<tab>" . 'copilot-accept-completion-by-word)))
(provide 'init-ai) (provide 'init-ai)
;;; init-ai.el ends here ;;; init-ai.el ends here

View File

@ -66,20 +66,30 @@
)) ))
) )
;; Set de funciones de para las sugerencias de corfu. ;; Set de funciones de para las sugerencias de corfu.
(use-package cape (use-package cape
:ensure (:host github :repo "minad/cape") :ensure (:host github :repo "minad/cape")
:after corfu :after corfu
:hook (eglot-managed-mode . (lambda()
(setq completion-at-point-functions
(list (cape-capf-super
#'eglot-completion-at-point
#'cape-abbrev
#'cape-dabbrev
#'cape-history
#'cape-dict
#'cape-file
#'cape-keyword)))))
:bind (("C-c c f" . cape-file) :bind (("C-c c f" . cape-file)
("C-c c l" . cape-line)) ("C-c c l" . cape-line))
:init :init
(setq text-mode-ispell-word-completion nil) (setq text-mode-ispell-word-completion nil)
;; (add-to-list 'completion-at-point-functions #'cape-line) ;; Completar línea actual en función de lo que dice otras líneas de buffer. ;; (add-to-list 'completion-at-point-functions #'cape-line) ;; Completar línea actual en función de lo que dice otras líneas de buffer.
;; (add-to-list 'completion-at-point-functions #'cape-tex) ;; Completar Latex (caracteres unicode). ;; (add-to-list 'completion-at-point-functions #'cape-tex) ;; Completar Latex (caracteres unicode).
(add-to-list 'completion-at-point-functions #'cape-dict) ;; Completar desde un diccionario (por defecto toma el de linux que está en /usr/share/dict/words).
(add-to-list 'completion-at-point-functions #'cape-dabbrev) ;; Completar desde otras la palabras del buffer. (add-to-list 'completion-at-point-functions #'cape-dabbrev) ;; Completar desde otras la palabras del buffer.
(add-to-list 'completion-at-point-functions #'cape-abbrev) ;; Completar desde una abreviaciónes configuradas con add-global-abbrev (añadir abreviación global) o add-mode-abbrev (abreviación para el modo actual). (add-to-list 'completion-at-point-functions #'cape-abbrev) ;; Completar desde una abreviaciónes configuradas con add-global-abbrev (añadir abreviación global) o add-mode-abbrev (abreviación para el modo actual).
(add-to-list 'completion-at-point-functions #'cape-history) ;; Completar desde el historial de altocompletado
(add-to-list 'completion-at-point-functions #'cape-dict) ;; Completar desde un diccionario (por defecto toma el de linux que está en /usr/share/dict/words).
(add-to-list 'completion-at-point-functions #'cape-file) ;; Completar rutas de archivos. (add-to-list 'completion-at-point-functions #'cape-file) ;; Completar rutas de archivos.
(add-to-list 'completion-at-point-functions #'cape-keyword) ;; Completar desde keyword del lenguaje. (add-to-list 'completion-at-point-functions #'cape-keyword) ;; Completar desde keyword del lenguaje.

View File

@ -151,5 +151,13 @@ If PROJECT is not specified, assume current project root."
(apply #'< (mapcar (lambda (range) (- (cdr range) (car range))) (apply #'< (mapcar (lambda (range) (- (cdr range) (car range)))
(list l1 l2))))))))) (list l1 l2)))))))))
(defun corfu-auto-toggle()
"Toggle corfu autocomplete."
(interactive)
(global-corfu-mode 0)
(setq corfu-auto (not corfu-auto))
(global-corfu-mode 1)
)
(provide 'init-functions) (provide 'init-functions)
;;; init-functions.el ends here. ;;; init-functions.el ends here.

View File

@ -88,7 +88,7 @@
:hook (prog-mode . (lambda () :hook (prog-mode . (lambda ()
(unless (derived-mode-p 'makefile-mode) (unless (derived-mode-p 'makefile-mode)
(flymake-mode)))) (flymake-mode))))
:config :init
(remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake) (remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
) )

View File

@ -109,10 +109,10 @@
;; UI para completado del minibuffer ;; UI para completado del minibuffer
(use-package vertico (use-package vertico
:bind (:map vertico-map :bind (:map vertico-map
("RET" . vertico-directory-enter) ("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char) ("DEL" . vertico-directory-delete-char)
("TAB" . minibuffer-complete) ("TAB" . minibuffer-complete)
("M-DEL" . vertico-directory-delete-word)) ("M-DEL" . vertico-directory-delete-word))
:hook ((elpaca-after-init . vertico-mode) :hook ((elpaca-after-init . vertico-mode)
(rfn-eshadow-update-overlay . vertico-directory-tidy)) (rfn-eshadow-update-overlay . vertico-directory-tidy))
:config :config

View File

@ -185,10 +185,11 @@
("w" global-display-fill-column-indicator-mode "fill column indicator" :toggle t) ("w" global-display-fill-column-indicator-mode "fill column indicator" :toggle t)
("t" global-hl-todo-mode "todo" :toggle t)) ("t" global-hl-todo-mode "todo" :toggle t))
"Program" "Program"
(("f" flymake-mode "flymake" :toggle t) (("F" flymake-mode "flymake" :toggle t)
("c" flyspell-mode "spell check" :toggle t) ("f" flyspell-mode "spell check" :toggle t)
("u" subword-mode "subword" :toggle t) ("u" subword-mode "subword" :toggle t)
("v" global-diff-hl-mode "gutter" :toggle t) ("v" global-diff-hl-mode "gutter" :toggle t)
("c" global-copilot-mode "copilot" :toggle t)
("V" diff-hl-flydiff-mode "live gutter" :toggle t) ("V" diff-hl-flydiff-mode "live gutter" :toggle t)
("M" diff-hl-margin-mode "margin gutter" :toggle t) ("M" diff-hl-margin-mode "margin gutter" :toggle t)
("D" diff-hl-dired-mode "dired gutter" :toggle t)) ("D" diff-hl-dired-mode "dired gutter" :toggle t))