Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

291–300 of 406 posts

Re: Quick tip for developers who use OS X

#291
post #253
post #244

Earlier quoted context omitted.

I use these settings in my .inputrc. The get me a few more commands and even the ability to escape using jj. set completion-ignore-case On set bell-style none set editing-mode vi $if mode=vi set keymap vi-command "gg": beginning-of-history "G": end-of-history set keymap vi-insert "jj": vi-movement-mode "\C-p": history-search-backward

Thanks for this. I switched my input mode to VI and was greatly missing using Ctrl-L to clear the screen when in input mode. I hadn't known about the inputrc before. Adding this line below your "\C-p" line fixed that for me: "\C-l": clear-screen

Oh wow, I didn't even think about that. I've been making do with Cmd+K on OSX and aliasing c to clear to get around the problem.

Re: Quick tip for developers who use OS X

#292
post #183

Earlier quoted context omitted.

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…

"X Window software" hasn't really changed very much in the last couple decades. I use distinct Control, Shift, Meta/Alt, and Hyper keys. The blame lies with "desktop environments", not X. X has plenty of its own problems without getting Gnome's problems heaped on top. Edit: > It's only the this-​is-​finally-​the-​year-​of-​Linux-​on-​the-​desktop crowd slavishly imitating Microsoft's mistakes that screwed it up. Most…

Oh, I agree with you — I perhaps should have written something like “*nix workstation software” rather than “X Window software”. I do use a separate Meta as well, and try to avoid programs that can't be configured to use it (GNOME-aligned ones being the most common).

And hey, as far as ‘really shitty reimplementations of Growl’ go, even Apple has one now.

Re: Quick tip for developers who use OS X

#293
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…

Agreed, this was the reason for me to learn my first emacs shortcuts. Also, the option+click thing doesn't work in iTerm, so unfortunately it doesn't help me but -side note- it's amazing that after years of using OS X I can still discover small productivity features like this, and I think it stands for the thoughtfulness of the people behind it.

Re: Quick tip for developers who use OS X

#295
post #205

Two more (for Bash) - Ctrl-x, Ctrl-e will pop open your EDITOR so you can edit the command. Saving and closing the editor brings the command back in your terminal and automatically executes it. fc will bring up your EDITOR with the last typed command. (You can use fc -l to see a list of commands)

damn.. thats the real #yearslost for me. I should have focused on learning that instead of the wordback/forward commands.

Whoa! I actually like this better than setting vi mode on terminal.

Re: Quick tip for developers who use OS X

#296
post #244
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 use these settings in my .inputrc. The get me a few more commands and even the ability to escape using jj. set completion-ignore-case On set bell-style none set editing-mode vi $if mode=vi set keymap vi-command "gg": beginning-of-history "G": end-of-history set keymap vi-insert "jj": vi-movement-mode "\C-p": history-search-backward

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?

Re: Quick tip for developers who use OS X

#297
post #187
post #81

Earlier quoted context omitted.

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.

Fn... urgh. I hate these crippled laptop keyboards (and tiny neck pain inducing laptop monitors).

Re: Quick tip for developers who use OS X

#298

The first thing I do when setting up a new Mac is make the Caps Lock key into another Control key. System Preferences > Keyboard > Modifier Keys Saves lots of awkward pinky-bending.

I go one step further and bind it to Hyper (ctrl+alt+cmd), and use hyper for tiling window management, like "snap window top left of screen grid", etc.

https://github.com/lunixbochs/reslate

Re: Quick tip for developers who use OS X

#299
post #81

Earlier quoted context omitted.

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

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. Whose brilliant idea was that?

Re: Quick tip for developers who use OS X

#300

drag + drop files to terminal to get its location. I often do "cd " + dragon drop folder to get to that folder in terminal

There's a free app called Go2Shell that adds a button to finder to open the current directory in Terminal/iTerm. Also works great in conjunction with "open ."

You can drag/drop many things onto an application icon in the dock to open them in a new window.

This includes dragging a folder's proxy icon to the terminal app to open the current Finder window in a new terminal.

The proxy icon is the little icon in the top middle of the window, to the left of the name.

Post reply on HN