Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

331–340 of 406 posts

Re: Quick tip for developers who use OS X

#331
post #238

Earlier quoted context omitted.

Not to mention that the Mac community also pioneered keyboard driven launchers and Linguistic user interfaces like launchbar -> quicksilver -> Alfred. Even though I put a lot of effort into learning windows keyboard shortcuts it always frustrated me how difficult it was to use windows in situations where I didn't have a mouse, while I'd barely notice the same situation with a Mac.

OK here's one. I press command-option esc to Force Quit an app. But how do I then close the Force Quit window (which stays on top of all other windows) without the mouse? Thanks to anyone who's figured this out.

As was already said, Command-W. This will always close the active window.

What’s not as obvious is how to close this window without the mouse when you have switched to some application and Force Quit is no longer the active window. Command-Tab won’t allow you to switch to the Force Quit window since it’s not treated as an app by OS X. However, you can switch to the window by simply using the command for Force Quit again, i.e. pressing Command-Option-Esc, then closing the now active force quit menu with Command-W.

Re: Quick tip for developers who use OS X

#332
post #72

Nobody seems to have posted this yet: python -m SimpleHTTPServer I'd recommend an alias like "serve". It basically puts the current directory online (binds to 0.0.0.0:8000).

similarly, you can get a janky json pretty printer by doing:

   curl -s http://some/json/url | python -m json.tool

Re: Quick tip for developers who use OS X

#333

Earlier quoted context omitted.

Sorry, but this is laughable. Keyboard shortcuts are far more useful and consistent across applications in OS X. I'm failing to understand how you could form this opinion...which shortcuts / programs don't meet your expectations? I guess I can sum this up by saying OS X has an additional modifier key than Windows, so you basically have 33% more power right out of the gate. The "Windows Key" is nearly useless.

> Sorry, but this is laughable. Keyboard shortcuts are far more useful and consistent across applications in OS X. I don't agree with this at all. I find it baffling that a company of great designers made such bad decisions about keyboard shortcuts. Perhaps they are consistent, but they are consistently bad. Paste and match style (incredibly useful) is "alt-shift-command-v" i.e. four keys. There are plenty of other s…

I found this issue when using all kinds of programs, so here's a little trick using AppleScript. Put the following into a file in your home directory (I call mine .f12Keys)

  tell application "System Preferences"
      activate
      set current pane to pane "com.apple.preference.keyboard"
  end tell

  tell application "System Events"
      tell application process "System Preferences"
          click checkbox 1 of tab group 1 of window "Keyboard"
      end tell
      tell application "System Preferences" to quit
  end tell
Then, put the following line into your .bash_profile.

  alias f12="osascript .f12Keys"
Now whenever you need to switch the default behavior of function keys, simply open a new terminal window and type "f12". It takes my computer about half a second to execute. That's kind of the brilliance of Apple products and Cocoa. If there's something you do frequently, if it's in a GUI or otherwise, so long as it's written in Cocoa you can automate it. Yeah, most Apple users have never heard of AppleScript, but for those who use it for the little things every day, it's quite helpful.

Re: Quick tip for developers who use OS X

#334
post #296

Earlier quoted context omitted.

Is there a functional difference between putting... set editing-mode vi ... in one's inputrc and... set -o vi ... in one's .bashrc? I realize that .inputrc is the config file for Readline, and .bashrc is essentially a start-up file for Bash. But is it ever necessary to use both snippets?

I would imagine that .inputrc would serve as a superset in that all programs (for instance gdb) whiich use readline would now default to vi mode.

This is the most useful thing I've heard this (short) year. I've always been looking for a way to make readline globally default to vi mode. Thanks for that.

Re: Quick tip for developers who use OS X

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

to piggyback off of this... (not sure if this is in the thread already)

⌘ + ` to switch between different windows of current application

⌘ + SHIFT + ` to switch between different windows of current application (reverse order)

same for the general application switcher:

⌘ + TAB to switch between different windows of current application

⌘ + SHIFT + TAB to switch between different windows of current application (reverse order)

Re: Quick tip for developers who use OS X

#336
post #299

Earlier quoted context omitted.

ctrl-arrow (which breaks with Lion's Spaces default keys), or shift Home/End in Terminal. It's not that Macs are crappy, they just have different key bindings. I regularly work with Macs, Windows, and Linux for development and I've just learned to use the different key mappings. I don't think I'm quite as proficient in any one system because of that, though. For example, I have avoided learning the Emacs key bindings…

ctrl-arrow jumps to the next word boundary under Linux. Yes, other systems have other key bindings, but why do common things like jumping to the begin/end of a line need a key combination? And why aren't the characters written onto the keys? Every time I have to type some code on a Mac I have to press all the keys in order to find { } [ ] etc. At leas I learned not to quit the terminal when I want to enter a @ by now…

{ } [ ] are just above the return key...?

Re: Quick tip for developers who use OS X

#337
post #287
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…

To get [NORMAL] on the right side of the terminal like in Vim, I put this in my .zshrc file: function zle-line-init zle-keymap-select { VIM_PROMPT="%{$fg_bold[yellow]%} [% %{$reset_color%}NORMAL%{$fg_bold[yellow]%}]% %{$reset_color%}" RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1" zle reset-prompt }

Is there a bash version of that? I don't care about where it is too much.

Re: Quick tip for developers who use OS X

#339
post #225
post #116

Earlier quoted context omitted.

defaults write -g NSTextKillRingSize -string 4

Can you shed some light on how to access those other three from the GUI (whether using the command key or some other means)?

Sorry forgot some steps...You also have to rebind C-y to 'yankAndSelect:' (https://developer.apple.com/library/mac/documentation/Cocoa/...)

For the most in depth info on the Cocoa Text System: http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html

Re: Quick tip for developers who use OS X

#340
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 just realized you can use some of these Emacs commands in the Chrome browser address bar (not sure about others).
Post reply on HN