3 ms·
In bash, if you set $EDITOR to your favorite text editor, you can send the current line to $EDITOR with ctrl-x ctrl-e. After editing the command you can save an
by asciimov 2y ago
In bash, if you set $EDITOR to your favorite text editor, you can send the current line to $EDITOR with ctrl-x ctrl-e. After editing the command you can save and exit for the command to execute.
- cyberpunk 2y agoYou can also just press 'v' if you're using vi mode in ksh like hardened old unixbeards like me :}
- abound 2y agoAnd for the fish folk, it's Alt-e
- oalders 2y agoOr even just bind it to ctrl-e in bash: bind '\C-e: edit-and-execute-command'
- kragen 2y agothat sounds horrific. every time you tried to go to the end of the line you'd get interrupted by launching an editor!
- dgfitz 2y agoI always just use the home and end buttons for that kind of thing.
- kragen 2y agoi don't even know where they are without looking at the keyboard. then when i try to press them half the time i accidentally press insert or print-screen instead
- oalders 2y agoI have `set -o vi` so, `esc` and `$` takes me to the end of the line. `ctrl-e` is unused for me unless I bind it to something I think is useful.
- renewiltord 2y agoI use this with copilot.vim in Neovim and EDITOR=nvim to get AI shell autocomplete. It's pretty good! Got it from here https://twitter.com/arjie/status/1575201117595926530?s=46&t=K_8J6rG18DrV5bcCLDrrYw https://twitter.com/arjie/status/1575201117595926530?s=46&t=...
- drowsspa 2y agoI love these shortcuts but sadly I never remember them when I do need them
- 1vuio0pswjnm7 2y agofc builtin does the same thing. No ctrl-key sequences required. Just type "fc" With previous commands, one can also specify a particular editor instead of default $EDITOR For example, to edit the previous command with ed when EDITOR=vi fc -e ed A quick way to make shell scripts from command line history in vi mode (where 15th entry in history is the desired command line): fc 15 w1.sh %d wq