|
|
@@ -9,7 +9,7 @@
|
|
|
|
:defer t
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
;; Default backend: OpenRouter
|
|
|
|
;; Default backend: OpenRouter
|
|
|
|
(setq gptel-model 'google/gemini-2.5-flash
|
|
|
|
(setq gptel-model 'google/gemini-3.flash-preview
|
|
|
|
gptel-backend
|
|
|
|
gptel-backend
|
|
|
|
(gptel-make-openai "OpenRouter"
|
|
|
|
(gptel-make-openai "OpenRouter"
|
|
|
|
:host "openrouter.ai"
|
|
|
|
:host "openrouter.ai"
|
|
|
@@ -48,32 +48,32 @@
|
|
|
|
(after! gptel
|
|
|
|
(after! gptel
|
|
|
|
;; Coding assistant preset
|
|
|
|
;; Coding assistant preset
|
|
|
|
(gptel-make-preset 'coder
|
|
|
|
(gptel-make-preset 'coder
|
|
|
|
:description "Expert coding assistant"
|
|
|
|
:description "Expert coding assistant"
|
|
|
|
:backend "OpenRouter"
|
|
|
|
:backend "OpenRouter"
|
|
|
|
:model 'anthropic/claude-sonnet-4.5
|
|
|
|
:model 'anthropic/claude-sonnet-4.5
|
|
|
|
:system "You are an expert coding assistant. Provide high-quality code solutions, refactorings, and explanations. Be concise but thorough. Include error handling and follow best practices.")
|
|
|
|
:system "You are an expert coding assistant. Provide high-quality code solutions, refactorings, and explanations. Be concise but thorough. Include error handling and follow best practices.")
|
|
|
|
|
|
|
|
|
|
|
|
;; Code explainer preset
|
|
|
|
;; Code explainer preset
|
|
|
|
(gptel-make-preset 'explain
|
|
|
|
(gptel-make-preset 'explain
|
|
|
|
:description "Explain code to beginners"
|
|
|
|
:description "Explain code to beginners"
|
|
|
|
:system "Explain this code to a novice programmer. Use simple language and break down complex concepts.")
|
|
|
|
:system "Explain this code to a novice programmer. Use simple language and break down complex concepts.")
|
|
|
|
|
|
|
|
|
|
|
|
;; Refactoring preset
|
|
|
|
;; Refactoring preset
|
|
|
|
(gptel-make-preset 'refactor
|
|
|
|
(gptel-make-preset 'refactor
|
|
|
|
:description "Code refactoring expert"
|
|
|
|
:description "Code refactoring expert"
|
|
|
|
:model 'anthropic/claude-sonnet-4.5
|
|
|
|
:model 'anthropic/claude-sonnet-4.5
|
|
|
|
:system "You are a code refactoring expert. Improve code quality, readability, and performance while maintaining functionality. Explain your changes.")
|
|
|
|
:system "You are a code refactoring expert. Improve code quality, readability, and performance while maintaining functionality. Explain your changes.")
|
|
|
|
|
|
|
|
|
|
|
|
;; Quick answers preset
|
|
|
|
;; Quick answers preset
|
|
|
|
(gptel-make-preset 'quick
|
|
|
|
(gptel-make-preset 'quick
|
|
|
|
:description "Quick, concise answers"
|
|
|
|
:description "Quick, concise answers"
|
|
|
|
:model 'google/gemini-2.5-flash
|
|
|
|
:model 'google/gemini-2.5-flash
|
|
|
|
:system "Provide quick, concise answers. Be direct and to the point.")
|
|
|
|
:system "Provide quick, concise answers. Be direct and to the point.")
|
|
|
|
|
|
|
|
|
|
|
|
;; Documentation writer preset
|
|
|
|
;; Documentation writer preset
|
|
|
|
(gptel-make-preset 'docs
|
|
|
|
(gptel-make-preset 'docs
|
|
|
|
:description "Documentation writer"
|
|
|
|
:description "Documentation writer"
|
|
|
|
:system "Write clear, comprehensive documentation. Include examples and explain edge cases."))
|
|
|
|
:system "Write clear, comprehensive documentation. Include examples and explain edge cases."))
|
|
|
|
|
|
|
|
|
|
|
|
;;; ============================================================================
|
|
|
|
;;; ============================================================================
|
|
|
|
;;; gptel-quick - Quick lookups and explanations
|
|
|
|
;;; gptel-quick - Quick lookups and explanations
|
|
|
@@ -161,9 +161,9 @@
|
|
|
|
(when (use-region-p)
|
|
|
|
(when (use-region-p)
|
|
|
|
(let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
|
|
|
(let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
|
|
|
(gptel-request code
|
|
|
|
(gptel-request code
|
|
|
|
:system "Explain this code concisely in 2-3 sentences."
|
|
|
|
:system "Explain this code concisely in 2-3 sentences."
|
|
|
|
:callback (lambda (response info)
|
|
|
|
:callback (lambda (response info)
|
|
|
|
(message "Explanation: %s" response))))))
|
|
|
|
(message "Explanation: %s" response))))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun my/gptel-proofread-region ()
|
|
|
|
(defun my/gptel-proofread-region ()
|
|
|
|
"Proofread and improve selected text."
|
|
|
|
"Proofread and improve selected text."
|
|
|
@@ -183,6 +183,8 @@
|
|
|
|
(use-package! claude-code
|
|
|
|
(use-package! claude-code
|
|
|
|
:defer t
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
|
|
|
|
;; Unset CLAUDECODE to allow running Claude Code inside Emacs sub-processes
|
|
|
|
|
|
|
|
(setenv "CLAUDECODE" nil)
|
|
|
|
(setq claude-code-program "ccr"
|
|
|
|
(setq claude-code-program "ccr"
|
|
|
|
claude-code-program-switches '("code" "--dangerously-skip-permissions"))
|
|
|
|
claude-code-program-switches '("code" "--dangerously-skip-permissions"))
|
|
|
|
|
|
|
|
|
|
|
@@ -242,6 +244,71 @@
|
|
|
|
(when (eq claude-code-terminal-backend 'vterm)
|
|
|
|
(when (eq claude-code-terminal-backend 'vterm)
|
|
|
|
(setq-local vterm-max-scrollback 100000)))))
|
|
|
|
(setq-local vterm-max-scrollback 100000)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Gemini CLI Configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package! gemini-cli
|
|
|
|
|
|
|
|
:defer t
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
;; Set the Gemini executable
|
|
|
|
|
|
|
|
(setq gemini-cli-program "gemini"
|
|
|
|
|
|
|
|
gemini-cli-program-switches nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Use Eat backend
|
|
|
|
|
|
|
|
(setq gemini-cli-terminal-backend 'eat
|
|
|
|
|
|
|
|
;; Emacs-style editing in Gemini buffer: RET inserts newline, S-RET sends
|
|
|
|
|
|
|
|
gemini-cli-newline-keybinding-style 'shift-return-to-send)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Enable global mode
|
|
|
|
|
|
|
|
(gemini-cli-mode 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Emacs-style prefix key
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c g") gemini-cli-command-map)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Set Doom leader keybindings under SPC G
|
|
|
|
|
|
|
|
(map! :leader
|
|
|
|
|
|
|
|
(:prefix ("G" . "gemini-cli")
|
|
|
|
|
|
|
|
:desc "Start Gemini" "c" #'gemini-cli
|
|
|
|
|
|
|
|
:desc "Start in directory" "d" #'gemini-cli-start-in-directory
|
|
|
|
|
|
|
|
:desc "Continue conversation" "C" #'gemini-cli-continue
|
|
|
|
|
|
|
|
:desc "Resume session" "R" #'gemini-cli-resume
|
|
|
|
|
|
|
|
:desc "New instance" "i" #'gemini-cli-new-instance
|
|
|
|
|
|
|
|
:desc "Kill Gemini" "k" #'gemini-cli-kill
|
|
|
|
|
|
|
|
:desc "Kill all instances" "K" #'gemini-cli-kill-all
|
|
|
|
|
|
|
|
:desc "Send command" "s" #'gemini-cli-send-command
|
|
|
|
|
|
|
|
:desc "Send command with context" "x" #'gemini-cli-send-command-with-context
|
|
|
|
|
|
|
|
:desc "Send region/buffer" "r" #'gemini-cli-send-region
|
|
|
|
|
|
|
|
:desc "Send buffer file" "o" #'gemini-cli-send-buffer-file
|
|
|
|
|
|
|
|
:desc "Fix error at point" "e" #'gemini-cli-fix-error-at-point
|
|
|
|
|
|
|
|
:desc "Toggle window" "t" #'gemini-cli-toggle
|
|
|
|
|
|
|
|
:desc "Switch to buffer" "b" #'gemini-cli-switch-to-buffer
|
|
|
|
|
|
|
|
:desc "Select buffer" "B" #'gemini-cli-select-buffer
|
|
|
|
|
|
|
|
:desc "Toggle read-only" "z" #'gemini-cli-toggle-read-only-mode
|
|
|
|
|
|
|
|
:desc "Cycle mode" "M" #'gemini-cli-cycle-mode
|
|
|
|
|
|
|
|
:desc "Transient menu" "m" #'gemini-cli-transient
|
|
|
|
|
|
|
|
:desc "Slash commands" "/" #'gemini-cli-slash-commands
|
|
|
|
|
|
|
|
:desc "Fork conversation" "f" #'gemini-cli-fork
|
|
|
|
|
|
|
|
:desc "Send return" "y" #'gemini-cli-send-return
|
|
|
|
|
|
|
|
:desc "Send escape" "n" #'gemini-cli-send-escape
|
|
|
|
|
|
|
|
:desc "Send 1" "1" #'gemini-cli-send-1
|
|
|
|
|
|
|
|
:desc "Send 2" "2" #'gemini-cli-send-2
|
|
|
|
|
|
|
|
:desc "Send 3" "3" #'gemini-cli-send-3))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Optional: Configure window display (side window on right)
|
|
|
|
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
|
|
|
|
|
|
'("^\\*gemini"
|
|
|
|
|
|
|
|
(display-buffer-in-side-window)
|
|
|
|
|
|
|
|
(side . right)
|
|
|
|
|
|
|
|
(window-width . 90)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Optional: Enable auto-revert for files modified by Gemini
|
|
|
|
|
|
|
|
;; (global-auto-revert-mode 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Optional: Increase vterm scrollback for long conversations
|
|
|
|
|
|
|
|
(add-hook 'gemini-cli-start-hook
|
|
|
|
|
|
|
|
(lambda ()
|
|
|
|
|
|
|
|
(when (eq gemini-cli-terminal-backend 'vterm)
|
|
|
|
|
|
|
|
(setq-local vterm-max-scrollback 100000)))))
|
|
|
|
|
|
|
|
|
|
|
|
;; (use-package! claudemacs
|
|
|
|
;; (use-package! claudemacs
|
|
|
|
;; :defer t
|
|
|
|
;; :defer t
|
|
|
|
;; :commands (claudemacs claudemacs-transient-menu)
|
|
|
|
;; :commands (claudemacs claudemacs-transient-menu)
|
|
|
|