mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
Merge pull request #3659 from iamFIREcracker/cx-ce-editor-key-binding
Invoke the editor by pressing `C-x C-e`
This commit is contained in:
commit
4a8b17cb84
1 changed files with 16 additions and 0 deletions
16
aider/io.py
16
aider/io.py
|
@ -35,6 +35,7 @@ from rich.text import Text
|
|||
from aider.mdstream import MarkdownStream
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
from .editor import pipe_editor
|
||||
from .utils import is_image_file
|
||||
|
||||
# Constants
|
||||
|
@ -556,6 +557,21 @@ class InputOutput:
|
|||
def _(event):
|
||||
"Navigate forward through history"
|
||||
event.current_buffer.history_forward()
|
||||
|
||||
@kb.add("c-x", "c-e")
|
||||
def _(event):
|
||||
"Edit current input in external editor (like Bash)"
|
||||
buffer = event.current_buffer
|
||||
current_text = buffer.text
|
||||
|
||||
# Open the editor with the current text
|
||||
edited_text = pipe_editor(input_data=current_text)
|
||||
|
||||
# Replace the buffer with the edited text, strip any trailing newlines
|
||||
buffer.text = edited_text.rstrip('\n')
|
||||
|
||||
# Move cursor to the end of the text
|
||||
buffer.cursor_position = len(buffer.text)
|
||||
|
||||
@kb.add("enter", eager=True, filter=~is_searching)
|
||||
def _(event):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue