diff --git a/flake.nix b/flake.nix index a4bcddd..26e860c 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,10 @@ url = "github:t4ccer/agenix.el"; flake = false; }; + extra-package-chatgpt = { + url = "github:joshcho/ChatGPT.el"; + flake = false; + }; extra-package-copilot = { url = "github:zerolfx/copilot.el"; flake = false; diff --git a/init.el b/init.el index f33b0a5..7ba6700 100644 --- a/init.el +++ b/init.el @@ -48,8 +48,7 @@ (backup-directory-alist `(("." . ,temporary-file-directory))) (auto-save-files-name-transforms `((".*" ,temporary-file-directory t))) (backup-by-copying t) - (focus-follows-mouse t) - (mouse-autoselect-window t) + (focus-follows-mouse 't) :config (set-face-background 'vertical-border (face-background 'default)) (set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?┃)) @@ -465,7 +464,7 @@ (nix-ts-mode . (lambda () (require 'eglot) (add-to-list 'eglot-server-programs - '(nix-ts-mode . ("nixd"))) + '(nix-ts-mode . ("nil"))) ;; FIXME `nixd' completion not working, will give it a second try in the future ;; '(nix-ts-mode . ("nixd" :initializationOptions (:eval (:depth 10 :workers 4) ;; :formatting (:command "alejandra") @@ -794,29 +793,14 @@ This is meant to be an helper to be called from the window manager." ("C-c n l" . consult-org-roam-forward-links) ("C-c n r" . consult-org-roam-search)) -(use-package gptel - :custom - (gptel-api-key (getenv "OPENAI_API_KEY")) +(use-package chatgpt :config - (defun ccr/suggest-eshell-command () - (interactive) - (save-excursion - (eshell-bol) - (let ((start-pos (point)) - (end-pos (line-end-position))) - (gptel-request - (buffer-substring-no-properties start-pos end-pos) ;the prompt - :system "You are proficient with emacs shell (eshell), translate the following to something I could directly prompt to the shell. Your responses should only be code, without explanation or formatting." - :buffer (current-buffer) - :context (cons (set-marker (make-marker) start-pos) - (set-marker (make-marker) end-pos)) - :callback - (lambda (response info) - (if (not response) - (message "ChatGPT response failed with: %s" (plist-get info :status)) - (kill-region start-pos end-pos) - (insert response))))))) - ) + (dolist (e '(("spiega" . "Spiega il seguente") + ("documenta" . "Documenta il seguente usando la sintassi appropriata in modo che possa essere inserito nel codice") + )) + (push e chatgpt-code-query-map)) + :bind + ("C-c i" . chatgpt-query)) (use-package copilot :custom @@ -827,7 +811,7 @@ This is meant to be an helper to be called from the window manager." (use-package pass :config - (require 'password-store-otp) ;; FIXME use `use-pacakge' idiomatic way + (require 'password-store-otp) ;; FIXME use `use-pacakges' idiomatic way :bind (("C-c p p" . password-store-copy) ("C-c p o" . password-store-otp-token-copy) diff --git a/packages/packages.nix b/packages/packages.nix index a8aa22f..fb309eb 100644 --- a/packages/packages.nix +++ b/packages/packages.nix @@ -4,6 +4,7 @@ pkgs: epkgs: let depsPerPackage = { indent-bars = [elpaPackages.compat]; + chatgpt = [melpaPackages.polymode]; copilot = [melpaPackages.editorconfig melpaPackages.dash melpaPackages.s melpaPackages.f]; notmuch-notify = [melpaPackages.alert melpaPackages.notmuch]; }; @@ -97,7 +98,6 @@ pkgs: epkgs: let poly-org # casual org-re-reveal - gptel ]) ++ (with elpaPackages; [ delight kind-icon