Skip to content

Conversation

erbenmo
Copy link
Contributor

@erbenmo erbenmo commented Sep 9, 2025

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:

~/Documents/Work/2025/Project/amazon-q-developer-cli/crates/chat-cli $ cargo run --bin chat_cli -- settings chat.autocompletionKey o
   Compiling chat_cli v1.15.0 (/Users/moerben/Documents/Work/2025/Project/amazon-q-developer-cli/crates/chat-cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.86s
     Running `/Users/moerben/Documents/Work/2025/Project/amazon-q-developer-cli/target/debug/chat_cli settings chat.autocompletionKey o`

verified ctrl-o works in the above example ^^

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),
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants