Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

181–190 of 406 posts

Re: Quick tip for developers who use OS X

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

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.

And OS X doesn't steal Control for menu shortcuts. Control-V (literal) is not the same as Command-V (paste), Control-Z (suspend) is not the same as Command-Z (undo), and so on.

X Window software used to get this right, too; Unix workstations generally had another modifier (e.g. Meta, diamond on Suns) since they knew better than to hijack keys people would type in a terminal. It's only the this-​is-​finally-​the-​year-​of-​Linux-​on-​the-​desktop crowd slavishly imitating Microsoft's mistakes that screwed it up.

Re: Quick tip for developers who use OS X

#184

Earlier quoted context omitted.

It's not emacs, it's GNU Readline (or likely some BSD readline given apple and the GPL) http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html . The shortcuts also work in every text field in the OS.

Terminal may be using some kind of Readline, I dunno. But text objects in other OS X applications use emacs keybindings because NeXTSTEP has had them since time immemorial. Like 1990 or so. Doesn't have anything to do with GNU Readline so far as I know.

> Terminal may be using some kind of Readline

Terminal.app passes the key sequences to the application running inside of the terminal. The default shell (bash) uses GNU readline, which has an emacs-mode and a vi-mode (emacs is the default).

Terminal.app does not use any Cocoa text fields, so has nothing to do with the Emacs keybindings inherited from NeXTSTEP.

Re: Quick tip for developers who use OS X

#185
post #136
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 you tried Evil-mode, i actually using Emacs with this, now i got the power of emacs with the efficiency of Vi in one place.

Depends on how much of Vi/Vim you use. IIRC, Evil-mode doesn't implement everything.

Re: Quick tip for developers who use OS X

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

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 shortcuts that also require four keys. Four is too many. Three is too many for such an important function. This is absurd.

Using shortcuts in IDEs is a nightmare on most apple keyboard. e.g. Intellij, to run your program: alt-shift-f10. This is daft in itself, but it actually translates to function-alt-shift-f10 on many keyboards. Yes, you can change your settings, but then you could remap all your keys in any O/S. Miss the function key and you've just muted your volume.

I have no interest in slagging Apple off; I use their products almost exclusively, but this is obviously an area where they messed up. I'd love to see this fixed, although I understand why they probably won't.

Re: Quick tip for developers who use OS X

#187
post #81

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

Because crappy Macs have no Home/End keys (or they don't work as such).

On most macs, Fn + left/right arrow are home/end. Fn + up/down are pageup/pagedown.

Re: Quick tip for developers who use OS X

#188
post #106

Earlier quoted context omitted.

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.

More: - C-u to kill (cut) from current location to beginning of the line - C-k to kill (cut) from current location to end of line - C-w to kill (cut) from current location to beginning of word - C-y to paste (copied / cut) lines - C-l to clear screen (I use the shit out of this) - Ctrl + shift + '-' (holding ctrl, shift, minus at the same time), for undo. That is it. EDIT: Damn it, I didn't realize I was saying a bun…

Pressing ESC and then _ will insert the last argument of the last line. Repeat to go up in the history.

If you go through the command history and press CTRL-o on a line it will be executed and the command on the commandline will be replaced by the next line in the history.

Re: Quick tip for developers who use OS X

#189
post #106

Earlier quoted context omitted.

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.

More: - C-u to kill (cut) from current location to beginning of the line - C-k to kill (cut) from current location to end of line - C-w to kill (cut) from current location to beginning of word - C-y to paste (copied / cut) lines - C-l to clear screen (I use the shit out of this) - Ctrl + shift + '-' (holding ctrl, shift, minus at the same time), for undo. That is it. EDIT: Damn it, I didn't realize I was saying a bun…

also alt + backspace, works similar to ctrl + w, but word is defined as only alphanumerics. Very useful when deleting parts of the long file paths because it will stop on / character (unlike C-w that deletes the whole path)

Re: Quick tip for developers who use OS X

#190

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…

> Using shortcuts in IDEs is a nightmare on most apple keyboard. e.g. Intellij, to run your program: alt-shift-f10. This is daft in itself, but it actually translates to function-alt-shift-f10 on many keyboards. Yes, you can change your settings, but then you could remap all your keys in any O/S. Miss the function key and you've just muted your volume.

I really find that hard to see as anything but the IDE's fault, probably due to cross platform shortcuts not rethought for OS X - but even then, something like 40 base non-function keys times at least four combinations of modifiers, and something as important as running the program gets relegated to alt-shift-F10?

Post reply on HN