-
Notifications
You must be signed in to change notification settings - Fork 286
Change autocomplete shortcut from ctrl-f to ctrl-g #2825
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
base: main
Are you sure you want to change the base?
Conversation
The reason is ctrl-f is the standard shortcut in UNIX for moving cursor forward by 1 character. You can find it being supported everywhere... in your browser, your terminal, etc.
rl.bind_sequence( | ||
KeyEvent(KeyCode::Char('f'), Modifiers::CTRL), | ||
KeyEvent(KeyCode::Char('g'), Modifiers::CTRL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have precedent to make shortcuts customizable. We should probably follow suit there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that feels like a separate feature request. Looking at the "TangentModeKey" code below we already have a mechanism to configure the key. My goal in this PR is to just make ctrl-f available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can just copy the mechanism there and the whole debate about the right key ends. We had the same discussion during tangent mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem of setting up a good default value will not go away though, even when user can configure everything in the future. I am trying to solve the default value problem here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://fishshell.com/docs/current/interactive.html
Arguably the shortcut comment here is no longer accurate, as a fish
user would expect Ctrl+f. Rather than just change the default key, I think we may want to just spend the time to build the config feature.
If we're strongly set on changing the key, we should remove that comment on L482, as it's not accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the latest PR I am allowing user to configure the key for autocompletion through:
cargo run --bin chat_cli -- settings chat.autocompletionKey o
This is following the existing config system built for tangent mode, fuzzy search, etc.
I am also changing the default from f to g
Description of changes:
The reason is ctrl-f is the standard shortcut in UNIX for moving cursor forward by 1 character. You can find it being supported everywhere... in your browser, your terminal, etc.
Test
Manually tested ctrl-g and ctrl-f in the CLI
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Also tested overriding the shortcut through config:
verified ctrl-o works in the above example ^^