Live data from Hacker News

Bash One-Liners Explained, Part V: Navigating around

catonmat.net

1–10 of 35 posts

Re: Bash One-Liners Explained, Part V: Navigating around

#5
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

#6
post #5

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).

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

#7
post #5

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).

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

#8
post #5

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).

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

#9
My biggest complaint is that the semantics of CTRL-w and ALT-b are different. CTRL-w goes to the last space, and ALT-b goes to the nearest non-letter. Why did they define word in two different ways for the two different commands? I would kill for a non-deleting version of CTRL-w; if I have a long path in a command-line I want to be able to move to the previous parameter, not just the previous path element.

Re: Bash One-Liners Explained, Part V: Navigating around

#10
post #5

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).

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)

Post reply on HN