-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
Added "accept-to-edit" for (Back)Space / Home / Left #2000
base: main
Are you sure you want to change the base?
Conversation
The above keys edit the selected command (as with hitting Tab), but like if using them in the shell. They only trigger when the search input is currently empty, and must be enabled individually with the respective boolean config options: * exit_with_backspace: right-trim command and remove last character * exit_with_space: right-trim and append a space character * exit_with_home: start editing at position 0 * exit_with_cursor_left: right-trim and start editing at last character * exit_positions_cursor: enable cursor positioning for Home and Left keys (bash-only) Updated bash init to support cursor positioning. For other shells, Home and Left keys will behave like Tab. Resolves atuinsh#1906
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.
}; | ||
// Bash's READLINE_POINT is required or positioning the cursor; we still allow | ||
// to go back to the shell even when not using bash (if user's configure the | ||
// respective options), but the actual positioning is only possible with bash |
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 it's possible with Zsh. The text before the cursor position can be stored in LBUFFER
, and the text after the cursor position can be stored in RBUFFER
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.
Thanks for the pointer. I'll have a look at L/RBUFFER and zsh.
Co-authored-by: Koichi Murase <[email protected]>
Co-authored-by: Koichi Murase <[email protected]>
I agree. Just looking at my changes, you'd probably also want to add Ctrl-W, Ctrl-Left, and who knows what else...being able to achieve the same via some kind of configuration would be much nicer than having to change code. Looking through #193 it seems #1763 also had the same kind of feature in mind ("accept-to-edit" keys). |
The above keys edit the selected command (as with hitting Tab), but like if using them in the shell. They only trigger when the search input is currently empty, and must be enabled individually with the respective boolean config options:
exit_with_backspace: right-trim command and remove last character
exit_with_space: right-trim and append a space character
exit_with_home: start editing at position 0
exit_with_cursor_left: right-trim and start editing at last character
exit_positions_cursor: enable cursor positioning for Home and Left keys (bash-only)
Updated bash init to support cursor positioning. For other shells, Home and Left keys will behave like Tab.
Resolves #1906
Checks