1 hour ago · Tech · hide · 0 comments

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…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.