Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change keybindings for refactor of highlighted buffer #463

Closed
kyle-okami opened this issue Nov 5, 2024 · 2 comments
Closed

change keybindings for refactor of highlighted buffer #463

kyle-okami opened this issue Nov 5, 2024 · 2 comments
Labels
question Further information is requested

Comments

@kyle-okami
Copy link

kyle-okami commented Nov 5, 2024

When I highlight a section of code in a buffer and press C-u gptel-send, then "r" twice, the refactoring process begins. After refactoring, the modified code is highlighted, displaying the label REFACTOR_READY. To accept or clear this refactored code, the keybindings are C-c C-a and C-c C-k, respectively.

How can I rebind these actions so that when my cursor is in the highlighted region, I can press "a" to accept or "q" to clear instead?

@kyle-okami kyle-okami added the question Further information is requested label Nov 5, 2024
@karthink
Copy link
Owner

karthink commented Nov 5, 2024

These keybindings are in the gptel-rewrite-actions-map keymap, so you can set them like:

(keymap-set gptel-rewrite-actions-map "a" 'gptel--rewrite-apply)

See M-x describe-keymap gptel-rewrite-actions-map for the bindings and commands.


As an aside, here's how you could discover this yourself: when the refactoring is ready, instead of running C-c C-a (say), run M-x describe-key C-c C-a. This pops up a help window with the following text:

C-c C-a runs the command gptel--rewrite-apply (found in
gptel-rewrite-actions-map), which is an interactive Lisp closure in
‘gptel-rewrite.el’.

It is bound to C-c C-a.

(gptel--rewrite-apply &optional OVS)

Apply pending LLM responses in OVS or at point.

[back]

As you can see, it shows you the command and the keymap where it is found.


Please close this issue if the answer is satisfactory.

@karthink
Copy link
Owner

karthink commented Jan 2, 2025

Closing as the issue is resolved. Please reopen otherwise.

@karthink karthink closed this as completed Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants