Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're using bash, you can edit long commands by hitting C-x C-e. This will open an editor with the command in the buffer. When you save and exit, bash will execute the edited command.

This is not in the style of `transient` in Emacs but it could work well, especially with your wrapper script that takes command line flags.



In addition, I think bash's `operate-and-get-next` can be very helpful. When you go back through your shell history, you can hit Ctrl+o instead of enter and it will execute the command then put the next one in your history on the command line, and keep track of where you are in your history. This way, you can rerun a bunch of commands by going to the first one and Ctrl+o till you are done. And you can edit those commands and hit Ctrl+o and still go to the next previously run command.

Note: fzf's history search feature breaks this. https://github.com/junegunn/fzf/issues/2399

Edit: And up and down will still keep the relative position you are at in your history in case you want to skip a command.


I use this in combination with FZF's ctrl-r command history which allows me to fuzzy search command history.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: