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

here's the magic line in .*rc that you didn't know you need:

`set -o vi`

It applies vi rules to your command line.



Or its more sane friend, control-x+control-e to launch $EDITOR with a file in $TMPDIR containing the current command-line, and then execute it when $EDITOR exits. BTW, I don't mean "$EDITOR" as a placeholder for whatever editor is your favorite, I quite literally mean the shell variable "EDITOR". Strictly speaking, $VISUAL has precedence but I don't think any system sets that one by default, whereas many do set EDITOR. I guess the one drawback to this comment in reply to yours is that the very bottom of that fallback tree is "emacs", but what vimmer doesn't already have EDITOR=$(command -v vi)? :-D

The gory details: https://www.gnu.org/software/bash/manual/html_node/Miscellan...


I love vi bindings but I've found that if you're using oh-my-zsh this will break a bunch of stuff like the command history. If anyone knows of a workaround for that I'd love to hear about it.




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

Search: