mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
add /editor command
Opens an editor for constructing a user prompt, using the currently defined chat mode. The editor is determined as follows: Look for the following environment variables, in order: 1. AIDER_EDITOR 2. VISUAL 3. EDITOR If none of these are defined, use the following defaults: Windows: notepad OS X: vim *nix: vi If an editor is not found, a RuntimeError is raised. Any arguments passed after the /editor command are inserted as content. The temporary file used for editing has an .md extension, which can be leveraged for syntax highlighting. NOTE: The editor used MUST block the process until the editor is closed -- the default editors all do this.
This commit is contained in:
parent
0022c1a67e
commit
d8e9da35d6
3 changed files with 162 additions and 6 deletions
15
aider/io.py
15
aider/io.py
|
@ -457,14 +457,17 @@ class InputOutput:
|
|||
log_file.write(f"{role.upper()} {timestamp}\n")
|
||||
log_file.write(content + "\n")
|
||||
|
||||
def display_user_input(self, inp):
|
||||
if self.pretty and self.user_input_color:
|
||||
style = dict(style=self.user_input_color)
|
||||
else:
|
||||
style = dict()
|
||||
|
||||
self.console.print(Text(inp), **style)
|
||||
|
||||
def user_input(self, inp, log_only=True):
|
||||
if not log_only:
|
||||
if self.pretty and self.user_input_color:
|
||||
style = dict(style=self.user_input_color)
|
||||
else:
|
||||
style = dict()
|
||||
|
||||
self.console.print(Text(inp), **style)
|
||||
self.display_user_input(inp)
|
||||
|
||||
prefix = "####"
|
||||
if inp:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue