-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: make the current cmdline editable in place #245
Comments
Hi @IndianBoy42, I think this is a good idea. What binding are you using to do this in fish? I am currently doing the same thing for but with bash edit-and-execute-command (C-x C-e). I need to figure out if there is a way to grab the current command in a shell agnostic way (or maybe just support bash, zsh, fish). Kitty may have something around this related to shell integration, I'll take a look. |
In fish it's `Alt+e`
Shell agnostic is ideal, but if not then covering bash zsh and fish should cover 99% of users.
|
Thanks! Looks like https://unix.stackexchange.com/questions/6620/how-to-edit-command-line-in-full-screen-editor-in-zsh
I'll have to think about the implementation of this a bit, but can hopefully come up with something 👍 |
After checking it out a bit I think direct shell integration is necessary. OSC133 doesn't mark the cmdline editable area. The user modifies the edit command binding so that it is something like |
Thanks! I agree, this sounds like the approach to take.
I'm not sure how long the temporary file is available but we could also There is an after_ready callback that may make sense to hook into for this. Maybe something like
Would need to maybe create a helper script or a way to pass the filename and then in the I've been busy of late, so not sure when I'll have time to dedicate to implementing. But, I think we are going down the right track. |
Hey @IndianBoy42 I have a draft PR #253 for this feature that I am still working on. It is in a good state, I just need to document and write tests. If you'd like to try it out and give me feedback, use the branch feat-command-line-editing-mode. You will have to run the command {
'mikesmithgh/kitty-scrollback.nvim',
-- ...
cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth', 'KittyScrollbackGenerateCommandLineEditing', },
-- ...
} It will look something like this (but have updated paths for your machine): # add the following function and bindings to your fish config (e.g., ~/.config/fish/config.fish)
function kitty_scrollback_edit_command_buffer
set -lx VISUAL '/Users/mike/gitrepos/kitty-scrollback.nvim/scripts/edit_command_line.sh'
edit_command_buffer
commandline ''
end
bind --mode default \ee kitty_scrollback_edit_command_buffer
bind --mode default \ev kitty_scrollback_edit_command_buffer
bind --mode visual \ee kitty_scrollback_edit_command_buffer
bind --mode visual \ev kitty_scrollback_edit_command_buffer
bind --mode insert \ee kitty_scrollback_edit_command_buffer
bind --mode insert \ev kitty_scrollback_edit_command_buffer
Please let me know if it works for you or you have any issues 👍 Demo: fish-command-line-editing.mp4 |
Very cool! checking it out now. A cool tip for fish integration is that every fish script in I'm not sure how zsh plugins work but I suspect there is somewhere you could the bindings file automatically so it Just Works TM for users bash... 🤷 |
# [6.1.0](v6.0.0...v6.1.0) (2024-12-18) ### Features * edit the current command line for bash, fish, or zsh ([#253](#253)) ([d8f5433](d8f5433)), closes [/www.gnu.org/software/bash/manual/html_node/Miscellaneous-Commands.html#index-edit_002dand_002dexecute_002dcommand-_0028C_002dx-C_002de_0029](https://github.com//www.gnu.org/software/bash/manual/html_node/Miscellaneous-Commands.html/issues/index-edit_002dand_002dexecute_002dcommand-_0028C_002dx-C_002de_0029) [#245](#245)
🎉 This issue has been resolved in version 6.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sometimes I start typing a long complicated command and then I get annoyed with the lack of vim keybindings. My shell (fish) has a keybinding to open the current commandline in
$EDITOR
but then I lose sight of the scrollback, so its suboptimal.kitty-scrollback.nvim
has the potential to be useful here. Currently adding to the current commandline is easy, but there is no easy way to select, edit or replace the existing commandline.The text was updated successfully, but these errors were encountered: