Bash: edit line with $EDITOR 0 ▲ Jaime G. Wong 91 days ago · Tech · hide One obscure, but very useful Bash trick is CTRL+X CTRL+E, which will open $EDITOR to edit the current line. This means I can switch to a Vim session with whatever I was typing on intact. This is handy for those times where I need a search-and-replace operation or fix things in a long command or build a long complex command from scratch. I’m aware of Bash’s vi-mode, but I prefer using the default Emacs keybindings because I also work in other’s remote servers. Also, it’s a Vi emulation. I’ve used Tmux’s emulation and occasionaly it disrupts my flow when I expect to do a Vim motion and it’s not possible. I prefer the real thing. Be aware you’re editing a temporal file. If you’re building a command and want to reference a file in the current directory, typing ./ to have Vim propose autocompletion won’t help, because now you’re on /tmp. One thing I don’t like of Bash’s line edition, in comparison to zsh (the default shell in MacOS), is that, after editing, it automatically executes the… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town