一、軟件介紹
文末提供程序和源碼下載
? ? ? ?Aidermacs 通過集成 Aider(最強大的開源 AI 配對編程工具之一)為 Emacs 帶來了 AI 驅動的開發。如果您缺少 Cursor,但更喜歡生活在 Emacs 中,Aidermacs 提供了類似的 AI 功能,同時保持 Emacs 工作流程。
二、Key Features?主要特點
- 具有多個后端的智能模型選擇
- 內置 Ediff 集成,用于 AI 生成的更改
- 來自 Emacs 的增強文件管理
- 出色的可定制性和靈活的內容添加方式
三、Quick Start?快速開始
- Requirements?要求
- Emacs ≥ 26.1?Emacs ≥ 26.1 版
- Aider?幫助
- Transient?短暫的
- Download Aidermacs through?Melpa?or?Non-GNU Elpa, or clone manually
通過 Melpa 或非 GNU Elpa 下載 Aidermacs,或手動克隆 - Modify this?sample config?and place it in your Emacs?
init.el
:
修改此示例配置并將其放在您的 Emacs?init.el
?中:
(use-package aidermacs:bind (("C-c a" . aidermacs-transient-menu)):config; Set API_KEY in .bashrc, that will automatically picked up by aider or in elisp(setenv "ANTHROPIC_API_KEY" "sk-..."); defun my-get-openrouter-api-key yourself elsewhere for security reasons(setenv "OPENROUTER_API_KEY" (my-get-openrouter-api-key)):custom; See the Configuration section below(aidermacs-use-architect-mode t)(aidermacs-default-model "sonnet"))
- Open a project and run?
M-x aidermacs-transient-menu
?or?SPC a a
?(or your chosen binding).
打開一個項目并運行?M-x aidermacs-transient-menu
?or?SPC a a
?(或您選擇的綁定)。 - Add files and start coding with AI!
添加文件并開始使用 AI 編碼!
Spacemacs?太空馬克斯
For?Spacemacs?users:?對于 Spacemacs 用戶:
- Add?
aidermacs
?to your?dotspacemacs-additional-packages
?list in your?.spacemacs
?file:
將?aidermacs
?Add to list?dotspacemacs-additional-packages
?in your?.spacemacs
?file:
dotspacemacs-additional-packages '((aidermacs :variablesaidermacs-use-architect-mode taidermacs-default-model "sonnet")
)
- Add the keybinding to your?
dotspacemacs/user-config
?function in?.spacemacs
:
在?.spacemacs
?: 中將鍵綁定添加到函數?dotspacemacs/user-config
?中:
(defun dotspacemacs/user-config ();; Set leader key for Aidermacs(spacemacs/set-leader-keys "aa" 'aidermacs-transient-menu) ; Example binding SPC a a
)
- Open a project and run?
M-x aidermacs-transient-menu
?or?SPC a a
?(or your chosen binding).
打開一個項目并運行?M-x aidermacs-transient-menu
?or?SPC a a
?(或您選擇的綁定)。 - Add files and start coding with AI!
添加文件并開始使用 AI 編碼!
四、Usage?用法
Getting Started?開始
The main interface to Aidermacs is through its transient menu system (similar to Magit). Access it with:
Aidermacs 的主要界面是通過其瞬態菜單系統(類似于 Magit)。通過以下方式訪問它:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>M-x aidermacs-transient-menu
</code></span></span></span></span>
Or bind it to a key in your config:
或者將其綁定到配置中的鍵:
(global-set-key (kbd "C-c a") 'aidermacs-transient-menu)
Once the transient menu is open, you can navigate and execute commands using the displayed keys. Here's a summary of the main menu structure:
打開臨時菜單后,您可以使用顯示的鍵導航和執行命令。以下是主菜單結構的摘要:
Core?核心
a
: Start/Open Session (auto-detects project root)
a
?:啟動/打開會話(自動檢測項目根).
: Start in Current Directory (good for monorepos)
.
?:從當前目錄開始(適用于 monorepos)l
: Clear Chat History
l
?:清除聊天記錄s
: Reset Session
s
?:重置會話x
: Exit Session??x
?:退出會話
Persistent Modes?持久模式
1
: Code Mode??1
?:代碼模式2
: Chat/Ask Mode
2
?:聊天/詢問模式3
: Architect Mode
3
?:建筑師模式4
: Help Mode??4
?: 幫助模式
Utilities?公用事業
^
: Show Last Commit (if auto-commits enabled)
^
?:顯示上次提交(如果啟用了自動提交)u
: Undo Last Commit (if auto-commits enabled)
u
?:撤消上次提交(如果啟用了自動提交)R
: Refresh Repo Map
R
?:刷新 Repo Maph
: Session History
h
?: 會話歷史記錄o
: Change Main Model
o
?:更改主模型?
: Aider Meta-level Help
?
?: Aider 元級幫助
File Actions?文件作
f
: Add File (C-u: read-only)
f
?:添加文件(C-u:只讀)F
: Add Current File
F
?:添加當前文件d
: Add From Directory (same type)
d
?:從目錄添加(相同類型)w
: Add From Window
w
?:從窗口添加m
: Add From Dired (marked)
m
?: 從 Dired 添加(標記)j
: Drop File??j
?: 放置文件J
: Drop Current File
J
?:刪除當前文件k
: Drop From Dired (marked)
k
?: Drop From Dired (標記)K
: Drop All Files
K
?:刪除所有文件S
: Create Session Scratchpad
S
?:創建會話暫存器G
: Add File to Session
G
?:將文件添加到會話A
: List Added Files
A
?:列出添加的文件
Code Actions?代碼作
c
: Code Change??c
?: 代碼更改e
: Question Code
e
?: 問題代碼r
: Architect Change
r
?: 架構師變更q
: General Question
q
?: 一般問題p
: Question This Symbol
p
?: 質疑此符號g
: Accept Proposed Changes
g
?:接受建議的更改i
: Implement TODO
i
?:實施 TODOt
: Write Test??t
?: 編寫測試T
: Fix Test??T
?: 修復測試!
: Debug Exception
!
?:調試異常
The?All File Actions
?and?All Code Actions
?entries open submenus with more specialized commands. Use the displayed keys to navigate these submenus.
和?All File Actions
?All Code Actions
?entries 打開包含更專用命令的子菜單。使用顯示的鍵來導航這些子菜單。
五、文件管理和 AI 交互
使用 Aidermacs 時,您可以靈活地決定 AI 應該讀取和編輯哪些文件。以下是一些準則:
- Editable Files: Add files you want the AI to potentially edit. This grants the AI permission to both read and modify these files if necessary.
Editable Files(可編輯的文件):添加您希望 AI 可能編輯的文件。這將授予 AI 在必要時讀取和修改這些文件的權限。 - Read-Only Files: If you want the AI to read a file without editing it, you can add it as read-only. In Aidermacs, all add file commands can be prefixed with?
C-u
?to specify read-only access.
只讀文件:如果您希望 AI 讀取文件而不對其進行編輯,您可以將其添加為只讀。在 Aidermacs 中,所有 add file 命令都可以作為前綴?C-u
?以指定只讀訪問權限。 - Session Scratchpads: Use the session scratchpads (
S
) to paste notes or documentation that will be fed to the AI as read-only.
會話暫存器:使用會話暫存器 ()?S
?粘貼注釋或文檔,這些注釋或文檔將作為只讀饋送到 AI。 - External Files: The "Add file to session" (
G
) command allows you to include files outside the current project (or files in?.gitignore
), as Aider doesn't automatically include these files in its context.
外部文件: “Add file to session” (?G
?) 命令允許您包含當前項目之外的文件(或 中的?.gitignore
?文件),因為 Aider 不會自動將這些文件包含在其上下文中。
The AI can sometimes determine relevant files on its own, depending on the model and the context of the codebase. However, for precise control, it's often beneficial to manually specify files, especially when dealing with complex projects.
AI 有時可以根據模型和代碼庫的上下文自行確定相關文件。但是,為了進行精確控制,手動指定文件通常是有益的,尤其是在處理復雜項目時。
Aider encourages a collaborative approach, similar to working with a human co-worker. Sometimes the AI will need explicit guidance, while other times it can infer the necessary context on its own.
Aider 鼓勵一種協作方法,類似于與人類同事一起工作。有時 AI 需要明確的指導,而其他時候它可以自行推斷必要的上下文。
Prompt Files Minor Mode?Prompt Files Minor 模式
Aidermacs provides a minor mode that makes it easy to work with prompt files and other Aider-related files. When enabled, the minor mode provides these convenient keybindings:
Aidermacs 提供了一個次要模式,可以輕松處理提示文件和其他與 Aider 相關的文件。啟用后,minor 模式將提供以下方便的鍵綁定:
C-c C-n
?or?C-<return>
: Send line/region line-by-line
C-c C-n
?或?C-<return>
?:逐行發送/區域C-c C-c
: Send block/region as whole
C-c C-c
?:將塊/區域作為整體發送C-c C-z
: Switch to Aidermacs buffer
C-c C-z
?:切換到 Aidermacs 緩沖液
The minor mode is automatically enabled for:
次要模式會自動啟用:
.aider.prompt.org
?files (create with?M-x aidermacs-open-prompt-file
)
.aider.prompt.org
?文件(使用?M-x aidermacs-open-prompt-file
?創建 ).aider.chat.md
?files??.aider.chat.md
?文件.aider.chat.history.md
?files??.aider.chat.history.md
?文件.aider.input.history
?files??.aider.input.history
?文件
Configuration?配置
Pre-Run Hook
You can use the?aidermacs-before-run-backend-hook
?to run custom setup code before starting the Aider backend. This is particularly useful for:
在啟動 Aider 后端之前,您可以使用?aidermacs-before-run-backend-hook
?to run custom setup code。這特別適用于:
- Setting environment variables
設置環境變量 - Injecting secrets?注入密鑰
- Performing any other pre-run configuration
執行任何其他運行前配置
Example usage to securely set an OpenAI API key from password-store:
從 password-store 中安全設置 OpenAI API 密鑰的示例用法:
(add-hook 'aidermacs-before-run-backend-hook(lambda ()(setenv "OPENAI_API_KEY" (password-store-get "code/openai_api_key"))))
This approach keeps sensitive information out of your dotfiles while still making it available to Aidermacs.
這種方法將敏感信息排除在點文件之外,同時仍可供 Aidermacs 使用。
Default Model Selection?默認模型選擇
You can customize the default AI model used by Aidermacs by setting the?aidermacs-default-model
?variable:
您可以通過設置?aidermacs-default-model
?變量來自定義 Aidermacs 使用的默認 AI 模型:
(setq aidermacs-default-model "sonnet")
This enables easy switching between different AI models without modifying the?aidermacs-extra-args
?variable.
這樣可以在不同的 AI 模型之間輕松切換,?aidermacs-extra-args
?而無需修改變量。
Note: This configuration will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:此配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Dynamic Model Selection?動態模型選擇
Aidermacs offers intelligent model selection for solo (non-Architect) mode, automatically detecting and integrating with multiple AI providers:
Aidermacs 為單獨(非架構師)模式提供智能模型選擇,自動檢測并與多個 AI 提供商集成:
- Automatically fetches available models from supported providers (OpenAI, Anthropic, DeepSeek, Google Gemini, OpenRouter)
自動從支持的提供商(OpenAI、Anthropic、DeepSeek、Google Gemini、OpenRouter)獲取可用模型 - Caches model lists for quick access
緩存模型列表以便快速訪問 - Supports both popular pre-configured models and dynamically discovered ones
支持流行的預配置模型和動態發現的模型 - Handles API keys and authentication automatically from your .bashrc
自動處理來自 .bashrc 的 API 密鑰和身份驗證 - Provides model compatibility checking
提供模型兼容性檢查
The dynamic model selection is only for the solo (non-Architect) mode.
動態模型選擇僅適用于 solo (non-Architect) 模式。
To change models in solo mode:
要在 solo 模式下更改模型:
- Use?
M-x aidermacs-change-model
?or press?o
?in the transient menu
使用?M-x aidermacs-change-model
?或按下?o
?瞬態菜單中的 - Select from either:??從以下任一選項中選擇:
- Popular pre-configured models (fast)
流行的預配置模型 (快速) - Dynamically fetched models from all supported providers (comprehensive)
從所有支持的提供商處動態獲取模型(全面)
- Popular pre-configured models (fast)
The system will automatically filter models to only show ones that are:
系統將自動篩選模型,僅顯示符合以下條件的模型:
- Supported by your current Aider version
受當前 Aider 版本支持 - Available through your configured API keys
通過您配置的 API 密鑰提供 - Compatible with your current workflow
與您當前的工作流程兼容
Architect Mode - Separating Code Reasoning and Editing Models
架構師模式 - 分離代碼推理和編輯模型
Aidermacs features an experimental mode using two specialized models for each coding task: an Architect model for reasoning and an Editor model for code generation. This approach has?achieved state-of-the-art (SOTA) results on aider's code editing benchmark, as detailed in?this blog post.
Aidermacs 具有一種實驗模式,為每個編碼任務使用兩個專用模型:用于推理的 Architect 模型和用于代碼生成的 Editor 模型。這種方法在 aider 的代碼編輯基準測試中取得了最先進的 (SOTA) 結果,如本篇博客文章中所述。
To enable this mode, set?aidermacs-use-architect-mode
?to?t
. You must also configure the?aidermacs-architect-model
?variable to specify the model to use for the Architect role.
要啟用此模式,請設置為?aidermacs-use-architect-mode
?t
?。您還必須配置?aidermacs-architect-model
?變量以指定要用于 Architect 角色的模型。
By default, the?aidermacs-editor-model
?is the same as?aidermacs-default-model
. You only need to set?aidermacs-editor-model
?if you want to use a different model for the Editor role.
默認情況下,the?aidermacs-editor-model
?與?aidermacs-default-model
?相同。如果您想為 Editor 角色使用其他模型,則只需進行設置?aidermacs-editor-model
?。
When Architect mode is enabled, the?aidermacs-default-model
?setting is ignored, and?aidermacs-architect-model
?and?aidermacs-editor-model
?are used instead.
啟用 Architect 模式后,將忽略該?aidermacs-default-model
?設置,并?aidermacs-architect-model
?改用 。?aidermacs-editor-model
(setq aidermacs-use-architect-mode t)
You can switch to it persistently by?M-x aidermacs-switch-to-architect-mode
?(3
?in?aidermacs-transient-menu
), or temporarily with?M-x aidermacs-architect-this-code
?(r
?in?aidermacs-transient-menu
).
您可以通過?M-x aidermacs-switch-to-architect-mode
?(?3
?in?aidermacs-transient-menu
?) 永久切換到它,也可以使用?M-x aidermacs-architect-this-code
?() (?r
?in?aidermacs-transient-menu
?)臨時切換到它。
You can configure each model independently:
您可以單獨配置每個模型:
;; Default model used for all modes unless overridden
(setq aidermacs-default-model "sonnet");; Optional: Set specific model for architect reasoning
(setq aidermacs-architect-model "deepseek/deepseek-reasoner");; Optional: Set specific model for code generation
(setq aidermacs-editor-model "deepseek/deepseek-chat")
The model hierarchy works as follows:
模型層次結構的工作原理如下:
- When Architect mode is enabled:
啟用 Architect 模式后:- The Architect model handles high-level reasoning and solution design
Architect 模型處理高級推理和解決方案設計 - The Editor model executes the actual code changes
Editor 模型執行實際的代碼更改
- The Architect model handles high-level reasoning and solution design
- When Architect mode is disabled, only?
aidermacs-default-model
?is used
禁用 Architect 模式時,僅使用?aidermacs-default-model
- You can configure specific models or let them automatically use the default model
您可以配置特定模型或讓它們自動使用默認模型
Models will reflect changes to?aidermacs-default-model
?unless they've been explicitly set to a different value.
模型將反映更改,?aidermacs-default-model
?除非它們已明確設置為不同的值。
Note: These configurations will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:這些配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Customize Weak Model?自定義弱模型
The Weak model is used for commit messages (if you have?aidermacs-auto-commits
?set to?t
) and chat history summarization (default depends on –model). You can customize it using
弱模型用于提交消息(如果已?aidermacs-auto-commits
?設置為?t
?)和聊天歷史記錄摘要(默認值取決于 –model)。您可以使用
;; default to nil
(setq aidermacs-weak-model "deepseek/deepseek-chat")
You can change the Weak model during a session by using?C-u o
?(aidermacs-change-model
?with a prefix argument). In most cases, you won't need to change this as Aider will automatically select an appropriate Weak model based on your main model.
您可以在會話期間使用?C-u o
?aidermacs-change-model
?帶有 prefix 參數的 () 來更改 Weak 模型。大多數情況下,你不需要更改此設置,因為 Aider 會根據你的主模型自動選擇合適的 Weak 模型。
Note: These configurations will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:這些配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Architect Mode Confirmation
架構師模式確認
By default, Aidermacs requires explicit confirmation before applying changes proposed in Architect mode. This gives you a chance to review the AI's plan before any code is modified.
默認情況下,Aidermacs 需要明確確認,然后才能應用在 Architect 模式下建議的更改。這使您有機會在修改任何代碼之前查看 AI 的計劃。
If you prefer to automatically accept all Architect mode changes without confirmation (similar to Aider's default behavior), you can enable this with:
如果您希望在不確認的情況下自動接受所有 Architect 模式更改(類似于 Aider 的默認行為),您可以通過以下方式啟用此功能:
(setq aidermacs-auto-accept-architect t)
Note: These configurations will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:這些配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Terminal Backend Selection
終端后端選擇
Choose your preferred terminal backend by setting?aidermacs-backend
:
通過設置?aidermacs-backend
?選擇您喜歡的終端后端 :
vterm
?offers better terminal compatibility, while?comint
?provides a simple, built-in option that remains fully compatible with Aidermacs.
vterm
?提供更好的終端兼容性,同時?comint
?提供與 Aidermacs 完全兼容的簡單內置選項。
;; Use vterm backend (default is comint)
(setq aidermacs-backend 'vterm)
Available backends:?可用的后端:
comint
?(default): Uses Emacs' built-in terminal emulation
comint
?(默認):使用 Emacs 的內置終端仿真vterm
: Leverages vterm for better terminal compatibility
vterm
?:利用 vterm 實現更好的終端兼容性
Emacs theme support?Emacs 主題支持
The vterm backend will use the faces defined by your active Emacs theme to set the colors for aider. It tries to guess some reasonable color values based on your themes. In some cases this will not work perfectly; if text is unreadable for you, you can turn this off as follows:
vterm 后端將使用活動 Emacs 主題定義的人臉來設置 aider 的顏色。它會嘗試根據您的主題猜測一些合理的顏色值。在某些情況下,這不會完美工作;如果文本對您來說不可讀,您可以按如下方式關閉此功能:
;; don't match emacs theme colors
(setopt aidermacs-vterm-use-theme-colors nil)
Multiline Input Configuration
多線路輸入配置
You can customize keybindings for multiline input, this key allows you to enter multiple lines without sending the command to Aider. Press?RET
?normally to send the command.
您可以自定義多行輸入的鍵綁定,此鍵允許您輸入多行而無需將命令發送給 Aider。按 normally 鍵?RET
?發送命令。
;; Comint backend:
(setq aidermacs-comint-multiline-newline-key "S-<return>")
;; Vterm backend:
(setq aidermacs-vterm-multiline-newline-key "S-<return>")
Remote File Support with Tramp
Tramp 的遠程文件支持
Aidermacs fully supports working with remote files through Emacs' Tramp mode. This allows you to use Aidermacs on files hosted on remote servers via SSH, Docker, and other protocols supported by Tramp.
Aidermacs 完全支持通過 Emacs 的 Tramp 模式處理遠程文件。這允許通過 SSH、Docker 和 Tramp 支持的其他協議對遠程服務器上托管的文件使用 Aidermacs。
When working with remote files:
使用遠程文件時:
- File paths are automatically localized for the remote system
文件路徑會自動為遠程系統本地化 - All Aidermacs features work seamlessly across local and remote files
所有 Aidermacs 功能都可以在本地和遠程文件之間無縫工作 - Edits are applied directly to the remote files
編輯將直接應用于遠程文件 - Diffs and change reviews work as expected
差異和更改審核按預期工作
Example usage:?用法示例:
;; Open a remote file via SSH
(find-file "/ssh:user@remotehost:/path/to/file.py");; Start Aidermacs session - it will automatically detect the remote context
M-x aidermacs-transient-menu
Prompt Selection and History
提示選擇和歷史記錄
Aidermacs makes it easy to reuse prompts through:
Aidermacs 通過以下方式使重用提示變得容易:
- Prompt History?- Your previously used prompts are saved and can be quickly selected
提示歷史記錄 - 您以前使用的提示將被保存,并且可以快速選擇 - Common Prompts?- A curated list of frequently used prompts for common tasks defined in?
aidermacs-common-prompts
:
常見提示 - 在?aidermacs-common-prompts
?中定義的常見任務的常用提示的精選列表:
When entering a prompt, you can:
輸入提示時,您可以:
- Select from your history or common prompts using completion
使用完成功能從您的歷史記錄或常見提示中進行選擇 - Still type custom prompts when needed
在需要時仍鍵入自定義提示
The prompt history and common prompts are available across all sessions.
提示歷史記錄和常見提示在所有會話中都可用。
File Watching?文件監視
Enable watching for AI coding instructions in your repository files with?aidermacs-watch-files
:
使用以下命令?aidermacs-watch-files
?在存儲庫文件中啟用對 AI 編碼指令的監視:
;; Enable file watching
(setq aidermacs-watch-files t)
When enabled, Aidermacs will will watch all files in your repo and look for any AI coding instructions you add using your favorite IDE or text editor.
啟用后,Aidermacs 將監視您的存儲庫中的所有文件,并查找您使用自己喜歡的 IDE 或文本編輯器添加的任何 AI 編碼指令。
Specifically, aider looks for one-liner comments (# ...
,?// ...
?or?-- ...
, regardless of the comment style that language supports) that either start or end with?AI
,?AI!
?or?AI?
?like these:
具體來說,aider 會查找以 、?AI!
?開頭或結尾的?AI
?單行注釋(?# ...
?、 或?// ...
?-- ...
?,不管該語言支持的注釋樣式如何),或者?AI?
?像這樣:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code># Make a snake game. AI!
# What is the purpose of this method AI?// Write a protein folding prediction engine. AI!
</code></span></span></span></span>
Aidermacs will take note of all the comments that start or end with?AI
. Comments that include?AI!
?with an exclamation point or?AI?
?with a question mark are special. They trigger aider to take action to collect all the AI comments and use them as your instructions.
Aidermacs 將記錄所有以?AI
?.包含?AI!
?感嘆號或?AI?
?問號的注釋是特殊的。它們觸發 aider 采取行動收集所有 AI 評論并將其用作您的指令。
AI!
?triggers aider to make changes to your code.
AI!
?觸發 Aider 以更改您的代碼。AI?
?triggers aider to answer your question.
AI?
?觸發 aider 來回答您的問題。
Note: This feature currently only works in the vterm mode.
注意:此功能目前僅在 vterm 模式下有效。
Note: These configurations will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:這些配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Diff and Change Review?Diff 和 Change Review
Control whether to show diffs for AI-generated changes with?aidermacs-show-diff-after-change
:
控制是否顯示 AI 生成的更改的?aidermacs-show-diff-after-change
?差異 :
;; Enable/disable showing diffs after changes (default: t)
(setq aidermacs-show-diff-after-change t)
When enabled, Aidermacs will:
啟用后,Aidermacs 將:
- Capture the state of files before AI edits
在 AI 編輯之前捕獲文件狀態 - Show diffs using Emacs' built-in ediff interface
使用 Emacs 的內置 ediff 接口顯示差異 - Allow you to review and accept/reject changes
允許您查看和接受/拒絕更改
Re-Enable Auto-Commits?重新啟用自動提交
Aider automatically commits AI-generated changes by default. We consider this behavior?very?intrusive, so we've disabled it. You can re-enable auto-commits by setting?aidermacs-auto-commits
?to?t
:
默認情況下,Aider 會自動提交 AI 生成的更改。我們認為此行為非常具有侵入性,因此已禁用它。您可以通過設置為?aidermacs-auto-commits
?t
?:
;; Enable auto-commits
(setq aidermacs-auto-commits t)
With auto-commits disabled, you must manually commit changes using your preferred Git workflow.
禁用自動提交后,您必須使用首選的 Git 工作流程手動提交更改。
Note: This configuration will be overwritten by the existence of an?.aider.conf.yml
?file (see?details).
注意:此配置將被?.aider.conf.yml
?文件的存在覆蓋(請參閱詳細信息)。
Customize Aider Options with?aidermacs-extra-args
自定義?aidermacs-extra-args
?Aider 選項
If these configurations aren't sufficient, the?aidermacs-extra-args
?variable enables passing any Aider-supported command-line options.
如果這些配置還不夠,該?aidermacs-extra-args
?變量將允許傳遞任何 Aider 支持的命令行選項。
See the?Aider configuration documentation?for a full list of available options.
有關可用選項的完整列表,請參閱 Aider 配置文檔。
;; Set the verbosity:
(add-to-list 'aidermacs-extra-args "--verbose")
These arguments will be appended to the Aider command when it is run. Note that the?--model
?argument is automatically handled by?aidermacs-default-model
?and should not be included in?aidermacs-extra-args
.
這些參數將在運行時附加到 Aider 命令中。請注意,該?--model
?參數由?aidermacs-default-model
?自動處理,不應包含在?aidermacs-extra-args
?.
Overwrite Configuration with Configuration File
使用配置文件覆蓋配置
Aidermacs supports project-specific configurations via?.aider.conf.yml
?files. To enable this:
Aidermacs 通過?.aider.conf.yml
?文件支持特定于項目的配置。要啟用此功能,請執行以下作:
-
Create a?
.aider.conf.yml
?in your home dir, project's root, or the current directory, defining your desired settings. See the?Aider documentation?for available options.
.aider.conf.yml
?在主目錄、項目的根目錄或當前目錄中創建一個,以定義所需的設置。有關可用選項,請參閱 Aider 文檔。 -
Tell Aidermacs to use the config file in one of two ways:
告訴 Aidermacs 以兩種方式之一使用配置文件:;; Set the `aidermacs-config-file` variable in your Emacs config: (setq aidermacs-config-file "/path/to/your/project/.aider.conf.yml") ;; *Or*, include the `--config` or `-c` flag in `aidermacs-extra-args`: (setq aidermacs-extra-args '("--config" "/path/to/your/project/.aider.conf.yml"))
Note: You can also rely on Aider's default behavior of automatically searching for?.aider.conf.yml
?in the home directory, project root, or current directory, in that order. In this case, you do not need to set?aidermacs-config-file
?or include?--config
?in?aidermacs-extra-args
.
注意:您還可以依賴 Aider 的默認行為,即按順序在主目錄、項目根目錄或當前目錄中自動搜索?.aider.conf.yml
?。在這種情況下,您無需在 中設置?aidermacs-config-file
?或包含在?--config
?aidermacs-extra-args
?中。
- Important:?When using a config file, all other Aidermacs configuration variables supplying an argument option (e.g.,?
aidermacs-default-model
,?aidermacs-architect-model
,?aidermacs-use-architect-mode
) are?IGNORED. Aider will?only?use the settings specified in your?.aider.conf.yml
?file. Do not attempt to combine these Emacs settings with a config file, as the results will be unpredictable.
重要提示:使用配置文件時,所有其他提供參數選項的 Aidermacs 配置變量(例如?aidermacs-default-model
?, ,?aidermacs-architect-model
?aidermacs-use-architect-mode
?, ) 都將被忽略。Aider 將僅使用您?.aider.conf.yml
?文件中指定的設置。不要嘗試將這些 Emacs 設置與配置文件結合使用,因為結果將是不可預測的。 - Precedence:?Settings in?
.aider.conf.yml
?always?take precedence when a config file is explicitly specified.
優先級:當顯式指定配置文件時,中的?.aider.conf.yml
?設置始終優先。 - Avoid Conflicts:?When using a config file,?do not?include model-related arguments (like?
--model
,?--architect
, etc.) in?aidermacs-extra-args
. Configure?all?settings within your?.aider.conf.yml
?file.
避免沖突:使用配置文件時,請勿在?--model
?--architect
?aidermacs-extra-args
?.配置?.aider.conf.yml
?文件中的所有設置。
Claude 3.7 Sonnet Thinking Tokens
Claude 3.7 十四行詩思維代幣
Aider can work with Sonnet 3.7's?new thinking tokens. You can now enable and configure thinking tokens more easily using the following methods:
Aider 可以使用 Sonnet 3.7 的新思維令牌。現在,您可以使用以下方法更輕松地啟用和配置 Thinking Tokens:
-
In-Chat Command:?Use the?
/think-tokens
?command followed by the desired token budget. For example:?/think-tokens 8k
?or?/think-tokens 10000
. Supported formats include?8096
,?8k
,?10.5k
, and?0.5M
.
聊天內命令:使用?/think-tokens
?命令后跟所需的令牌預算。例如:?/think-tokens 8k
?或?/think-tokens 10000
?.支持的格式包括?8096
?、 、?8k
?10.5k
?和?0.5M
?。 -
Command-Line Argument:?Set the?
--thinking-tokens
?argument when starting Aidermacs. For example, you can add this to your?aidermacs-extra-args
:
命令行參數:在啟動 Aidermacs 時設置?--thinking-tokens
?參數。例如,您可以將 this 添加到您的?aidermacs-extra-args
?:(setq aidermacs-extra-args '("--thinking-tokens" "16k"))
These methods provide a more streamlined way to control thinking tokens without requiring manual configuration of?.aider.model.settings.yml
?files.
這些方法提供了一種更簡化的方式來控制思維令牌,而無需手動配置?.aider.model.settings.yml
?文件。
Note: If you are using an?.aider.conf.yml
?file, you can also set the?thinking_tokens
?option there.
注: 如果您使用的是?.aider.conf.yml
?文件,您也可以在此處設置該?thinking_tokens
?選項。
Working with Prompt Files
使用提示文件
The?.aider.prompt.org
?file is particularly useful for:
該文件?.aider.prompt.org
?特別適用于:
- Storing frequently used prompts
存儲常用提示 - Documenting common workflows
記錄常見工作流程 - Quick access to complex instructions
快速訪問復雜的說明
You can customize which files automatically enable the minor mode by configuring?aidermacs-auto-mode-files
:
您可以通過配置?aidermacs-auto-mode-files
?來自定義哪些文件自動啟用 minor 模式:
(setq aidermacs-auto-mode-files'(".aider.prompt.org"".aider.chat.md"".aider.chat.history.md"".aider.input.history""my-custom-aider-file.org")) ; Add your own files
六、軟件下載
夸克網盤分享
本文信息來源于GitHub作者地址:GitHub - MatthewZMD/aidermacs: AI Pair Programming in Emacs with Aider
?