Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

51–60 of 406 posts

Re: Quick tip for developers who use OS X

#52
Bash, running in your terminal, understands both the Emacs and the Vi commands. By default is Emacs, so you can C-a (control-a) for beginning of line, C-p to go back in command line history, or C-r to search it.

I prefer the Vi mode, though. Add to your .bashrc

set -o vi

Then you can press escape to go from input mode to normal mode; there k will take you to the previous line in command line history, j to the next line, ^ and $ to the beginning and end of the line, /something will search something back.

Editing is really fast; move by words with w (forward) and b (backward), do cw to replace a word, r to replace a letter, i to go back to input. It will remember the last editing command, just as Vi, and repeat it when you press . in normal mode.

Re: Quick tip for developers who use OS X

#55
I have tried to use Terminal, but I just can't. The ability to highlight and automatically have the text in clipboard is such a crucial feature in my workflow that not having it even as an option is a deal breaker.

Once I started with iTerm and built a config/flow around it, I can't go back.

Thanks for the tip though! I didn't realize this worked in Terminal too. I'll keep it in mind the next time I'm forced to use it.

Re: Quick tip for developers who use OS X

#57
post #52

Bash, running in your terminal, understands both the Emacs and the Vi commands. By default is Emacs, so you can C-a (control-a) for beginning of line, C-p to go back in command line history, or C-r to search it. I prefer the Vi mode, though. Add to your .bashrc set -o vi Then you can press escape to go from input mode to normal mode; there k will take you to the previous line in command line history, j to the next li…

I started using vi mode recently. The only thing that I really miss are ci and di commands.

Re: Quick tip for developers who use OS X

#58
post #32
post #28

Useful when copy/pasting things to share with other people in email and such: $ pbpaste | pbcopy takes the current contents of the copy/paste buffer and removes color/font/background color rich formatting and puts just plain text back into the paste buffer. And of course pbcopy and pbpaste are also very useful on their own.

You can also use shift-option-cmd-v to directly paste without markup :)

I can never remember which combination that is, but thanks.
Post reply on HN