aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/users/fcuny/configs/emacs/init.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/nix/users/fcuny/configs/emacs/init.el b/nix/users/fcuny/configs/emacs/init.el
index a474bd5..dd9869c 100644
--- a/nix/users/fcuny/configs/emacs/init.el
+++ b/nix/users/fcuny/configs/emacs/init.el
@@ -267,6 +267,37 @@
(load-theme 'modus-operandi-tinted :no-confirm)
+;;; 1Password Integration
+(defvar fcuny/op-item-cache nil)
+
+(defun fcuny/read-op-item (op-item-path)
+ "Read and cache OP-ITEM-PATH item."
+ (or (cdr (assoc op-item-path fcuny/op-item-cache))
+ (let ((key (string-trim-right
+ (shell-command-to-string (format "op read '%s'" op-item-path)))))
+ (unless (string-match-p "\\[ERROR\\]" key)
+ (push (cons op-item-path key) fcuny/op-item-cache)
+ key))))
+
+;;; gptel
+(require 'gptel)
+
+(with-eval-after-load 'gptel
+ (setq gptel-default-mode 'org-mode)
+ (gptel-make-anthropic "Claude"
+ :stream t
+ :key (lambda () (fcuny/read-op-item "op://Private/anthropic llm/credential"))))
+
+;;; aider
+(require 'aidermacs)
+
+(global-set-key (kbd "C-c a") 'aidermacs-transient-menu)
+
+(with-eval-after-load 'aidermacs
+ (setq aider-args '("--no-check-update" "--no-show-model-warnings"))
+ (setq aidermacs-default-model "claude-3-7-sonnet-latest")
+ (setenv "ANTHROPIC_API_KEY" (fcuny/read-op-item "op://Private/anthropic llm/credential")))
+
;;; server
(require 'server)
(unless (server-running-p)