News for hackers. Stuff that matters.
Re:Bash One-Liners Explained, Part V: Navigating around by JakeSc on Tuesday November 27, 2012 @02:20PM (#4838326)
This is a great guide. Especially awesome for me was: 26. Change input mode to vi

$ set -o vi This command changes the key bindings to vi's. If vi's your favorite editor, you'll love this. I'll cover the vi mode in more details in the next part of the article.

I'd love to find a cheat sheet for vi bash usage (and also an indicator for which editing mode I'm in).

Re:Bash One-Liners Explained, Part V: Navigating around by tsm on Tuesday November 27, 2012 @02:31PM (#4838389)
I'm a huge vi(m) fan, but still use Emacs-style readline. When editing code in vim, I tend to make several edits each time I'm in edit mode. When at the terminal, all I'll need is "go to front" or "search backwards". And which is easier: Esc+Shift-6+i or C-a? Esc+Shift-/ or C-r? I'm in no way an Emacs ninja, but it's not too hard to memorize the ten or so most common commands. Added bonus: they work in OS X and Qt textfields. Other added bonus: they work out of the box in terminals you haven't configured yourself.
Re:Bash One-Liners Explained, Part V: Navigating around by jlgreco on Tuesday November 27, 2012 @02:45PM (#4838496)
I like vi-mode in my shell primarily for j/k to navigate through history (arrow keys just always suck imho, and C-r to search backwards in history is just overkill most of the time) and 'c[motion]', which is what I almost exclusively find myself using to correct things I messed up ('d[motion]' pops up less frequently). 99% of the time those are 99% of the things I use; for that set of features I think the vi sequences are definitely have the advantage.
Re:Bash One-Liners Explained, Part V: Navigating around by pmr_ on Tuesday November 27, 2012 @04:49PM (#4839317)
The Emacs next-line and previous-line bindings C-n and C-p also work well for history navigation.
Re:Bash One-Liners Explained, Part V: Navigating around by gvalkov on Tuesday November 27, 2012 @06:22PM (#4839910)
You can enjoy the best of both worlds with something like zsh's edit-command-line. I'm very happy with Emacs keys in the shell, unless I need to make a non-trivial edit or type in a multi-line command. In those cases, C-x C-e drops me right into Vim with the current command-line ready for editing.
Re:Bash One-Liners Explained, Part V: Navigating around by don_draper on Wednesday November 28, 2012 @07:35AM (#4842194)
Anybody know how to do the equivalent of C-x C-e in vim mode?
Re:Bash One-Liners Explained, Part V: Navigating around by prakashk on Wednesday November 28, 2012 @10:20AM (#4842916)
Try ESC-v.
Re:Bash One-Liners Explained, Part V: Navigating around by jayferd on Tuesday November 27, 2012 @05:07PM (#4839422)
uhh... try Esc-I and Esc-A. And Ctrl-R still works in vi mode.
Re:Bash One-Liners Explained, Part V: Navigating around by tnorthcutt on Tuesday November 27, 2012 @02:25PM (#4838354)
You'll probably like this (includes cheat sheet): http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-shee...
Re:Bash One-Liners Explained, Part V: Navigating around by rauljara on Tuesday November 27, 2012 @02:37PM (#4838439)
Many thanks for pointing this out! I hadn't read far enough to get to it myself. I kind of wish it was closer to the top because it rendered most of the other tips kind of pointless. Well, not C-r, but I already knew that one.

This has made me even happier than learning I could get vim key bindings in vim's own command-line mode[1]. Thanks again!

[1](C-f from command-line mode, or q: from normal)

Re:Bash One-Liners Explained, Part V: Navigating around by anykey on Tuesday November 27, 2012 @02:31PM (#4838390)
I was excited when I found out about this a year ago and tried it out...I hated it, though. There's no indication as to what state you're in and it can get maddening at times!

Luckily, zsh actually allows you to change your prompt when the mode changes. I have mine set up to change the color of part of it whenever I'm in command mode. Definitely worth setting up.

Re:Bash One-Liners Explained, Part V: Navigating around by crazydiamond on Wednesday November 28, 2012 @12:08AM (#4841124)
| I'd love to find a cheat sheet for vi bash usage (and also an indicator for which editing mode I'm in).

In zsh, you can type: "bindkey" to get a listing. IIRC, in bash it is "bind -p".