Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

241–250 of 406 posts

Re: Quick tip for developers who use OS X

#241
post #166

This works if whatever is currently running in your terminal has support for the XTerm mouse escape sequences. Option-click is the shortcut to tell the terminal to forward the click to the application running in the terminal. That's usually your shell or some editor. I seem to faintly remember that at some point this was actually configurable and you could configure the terminal to forward non-option-clicks and only…

I can confirm that this works with VIM and nano

Re: Quick tip for developers who use OS X

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

Re: Quick tip for developers who use OS X

#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

Re: Quick tip for developers who use OS X

#245
post #234
post #169

Earlier quoted context omitted.

After using OS X for a few months, I weep every time I use the commandline on Windows. There's just no reason for Windows to be that bad.

Did you try Powershell?

Yup. I'm not going to get into a vacuous PowerShell bashing discussionlet here, but let's just say that PS didn't fulfill the promises the documentation made. I found that the marshaling semantics were often quite surprising and required awkward workarounds (really don't unflatten lists of people, okay?).

I second the "everything is about five syllables" and sure, you can set up aliases, but I went through that hell on VAX/VMS and don't want to go back.

Re: Quick tip for developers who use OS X

#246
post #234
post #169

Earlier quoted context omitted.

After using OS X for a few months, I weep every time I use the commandline on Windows. There's just no reason for Windows to be that bad.

Did you try Powershell?

I've tried powershell, but it still seems to launch in that same ancient command window they've used for years with the exceptionally strange copy & paste characteristics (seriously, why can't it copy wrapped multi-line wrapped commands without inserting newlines when I paste?). Also why does it want to scroll past the end of the buffer? Ugh.

Plus why are all the built-in commands like 20 characters long and camel cased?

Re: Quick tip for developers who use OS X

#247
post #213

Earlier quoted context omitted.

Also very useful for similar use cases is qlmanage. $ qlmanage -p

This seems to run whatever code usually runs when you hit [space] on a filename in a Finder window. (Except that it outputs a bunch of debugging information.) Under what circumstances is that any better or more useful than "open"?

Because it essentially acts like quick look for the terminal.

Re: Quick tip for developers who use OS X

#249

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.

I couldn't agree with you more! I used to be (a long time ago) a avid Windows user, and scoffed at Mac's. I then got into the publishing world where everything is Mac. The keyboard shortcuts are by far much more consistent and easier on OS X. I am scratching my head wondering how anyone could ever come up with a different conclusion, the difference is night and day.

It all depends on what you are doing.

The WindowsKey is often overlooked, for example, there are great key combinations for manipulating application windows. WindowsKey+Arrow moves the current window around in a logical way (up maximizes, left docks to left edge of screen, etc), WindowsKey+Shift+Arrow moves the current window to another monitor in a sensible fashion. Out of the box OS X doesn't seem to have equivalents.

Re: Quick tip for developers who use OS X

#250

Earlier quoted context omitted.

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.

In Bash, you also can use the $_ variable which is the last argument of the previous command: $ stat /tmp/foobar File: `/tmp/foobar' Size: 0 Blocks: 0 IO Block: 4096 ... $ rm -v $_ removed `/tmp/foobar'

You can also use `!$`.
Post reply on HN