Support emacs readline bindings when adding new log entry
shambles07 opened this issue · 4 comments
My apologies if this request has come up, I searched but was unable to find anything.
Is your feature request related to a problem? Please describe.
Yes, readline keyboard shortcuts are inaccessible from the changie new
prompt.
When creating a new entry using changie new
, the emacs keyboard shortcuts for readline (using both bash & zsh shells) are unusable, making traversing the input prompt tedious.
Example shortcuts:
- GNU Readline - Readline Movement Commands
- Alt-B: Jump back one word (
backward-word
) - Alt-F: Jump back one word (
backward-word
) - Ctrl-A: Jump to start of line
- Ctrl-E: Jump to end of line
- Alt-B: Jump back one word (
- GNU Readline - Readline Killing Commands
- Ctrl-U: Delete current line to start
- Ctrl-K: Delete current line to end
Describe the solution you'd like
Requesting support for the following emacs readline keyboard shortcuts:
- C-a (
beginning-of-line
) - C-e (
end-of-line
) - M-b (
backward-word
) - M-f (
forward-word
) - C-w (
unix-word-rubout
) - C-u (
unix-line-discard
) - C-k (
kill-line
) - M-d (
kill-word
) - C-y (
yank
)
Listed from most important to least important, movement would be most helpful, the kill/yank commands aren't really needed but would be nice to have access to.
Describe alternatives you've considered
I've seen others mention using other tools for formatting text such as #385.
Additional context
References:
- GNU Readline Library Documentation - Bindable Readline Commands - Commands supporting keybinding
- Shortcuts list
- chzyer/readline - shortcut.md – List of readline emacs shortcuts
- Readline Cheat Sheet - Emacs editing mode keyboard shortcuts
@shambles07 Hey, so a PR was just merged a short time ago changing the prompt package from promptui to one based on bubbletea ( #464 ). I do not use emacs or any of these shortcuts but if you wouldn't mind trying the source version of Changie.
The base package for inputs is now based on bubbletea, so in practice I believe this change would likely need to go in the text input package, I think bubbles.
@shambles07 v1.12.0 just released with the new prompt tool, this looks to support at least some of what you are looking for. For context, https://github.com/charmbracelet/bubbles is the base project of text input, so these keybindings would go there.
Thanks for the quick reply, your help is much appreciated! Let me try this out and I'll get back to you.
@miniscruff this worked perfectly—thanks again!