Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

141–150 of 406 posts

Re: Quick tip for developers who use OS X

#142
post #73
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.

Be warned, though, that these do not work inside of a tmux session without special steps being taken. I believe that they work in screen, but tmux requires some additional work.

You have to install "reattach-to-user-namespace" which you can do with homebrew.

Then you need to add the following to .tmux.conf

  set-option -g default-command "reattach-to-user-namespace -l zsh"
There's a good writeup on what and why here, https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/...

Re: Quick tip for developers who use OS X

#143
post #118

After making the switch to OS X in the last couple years after living in Linux and Windows before that, I think it's objective to say that keyboard shortcuts in OS X are much worse in both ease of use and consistency across applications.

After switching to OS X after spending years using Windows and then Linux, I found it patently the case that the keyboard shortcuts in OS X are much better in both ease of use and consistency across applications.

The use of the Command key and a bunch of standard shortcuts using it are particularly notable.

#notsoobjective

Re: Quick tip for developers who use OS X

#144
post #118

After making the switch to OS X in the last couple years after living in Linux and Windows before that, I think it's objective to say that keyboard shortcuts in OS X are much worse in both ease of use and consistency across applications.

Not sure if I'm falling for sarcasm, or just an outlier for feeling the exact opposite...

Same (and to be clear, this is from someone who only "switched" to OS X a few years ago because of the demands of my user community: and for the first year I hated it, as I liked neither the hardware nor OS X 10.5). So, to add some concrete-ness: what fundamentally makes OS X better at this is the way the command key is used; almost everything that has to do with the UI or the system is bound to the command key, which means that control and option are free for usage by my terminal. I thereby never run into any confusion using ctrl-c to copy something or alt-tab to switch between windows: command means nothing to my terminal, and control and option get bound to control and alt (not the default in Terminal, but its one checkbox to fix), passed to whatever actual application I'm running. On both Windows and Linux the control and alt keys tend to overlap in usage between graphical and console applications, meaning the graphical terminal I'm using invariably has some confusing overlap with the keyboard commands I might want to send to my console app. (Now, there are some unfortunate defaults in Terminal with relation to page up/down and home/end, but those are both easily fixed--a few minutes of setup before sitting down--and somewhat irrelevant as any one who even remotely cares about using a terminal should have installed iTerm2 forever ago.) (Ironically and relevantly, the reason Terminal has irritating defaults is specifically because Apple has actually been really good about having keyboard shortcuts be consistent across every application: they want option, page up, and home to do the exact same things in Terminal that it would do in any other app, even to the extent to which those behaviors are useless and counter-productive when you are actually just trying to use vim/emacs and bash/zsh like a normal person ;P.)

Re: Quick tip for developers who use OS X

#147
post #106
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…

C-a : beginning line, C-e end line, alt+f forward word (unless system shortcut for file menu), alt+b back word, C-k kill line, C-b back char, C-f forward char. At least in my current setup, C-w yank and C-y paste works as well. Immensely helpful. Sometimes at+left/right does forward/ back word depending on the terminal emu. Note most of these keystrokes are valid in nano as well.

http://tiswww.case.edu/php/chet/readline/readline.html

These work in most GUI inputs as well.

Re: Quick tip for developers who use OS X

#148
post #20

Two more tips: * Ctrl-a to go to beginning of line * Ctrl-e to go to end of line

A couple more: * ⌘ + ` (tilde key) to switch between different windows of your current application * ⌘ + l (lowercase L) in most web browsers to highlight the address bar

The former is the one thing I missed the most from my OSX days...until I got a tiling WW setup (i3).

Woohoo, love me some Linux, let choice reign ;-)

Re: Quick tip for developers who use OS X

#149
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.

ci and di aren't commands. c and d are operators and the i is part of the motion--specifically, text objects.

Re: Quick tip for developers who use OS X

#150

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 i…

Check out TotalTerminal. It's a plugin for Terminal that has that feature among others. http://totalterminal.binaryage.com
Post reply on HN