Live data from Hacker News

Quick tip for developers who use OS X

news.ycombinator.com

321–330 of 406 posts

Re: Quick tip for developers who use OS X

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

Signs you have to revert to Emacs mode. Unless it's an assemblage, it's always a smell if you replace a unit of a body with that of a "competitor."

Re: Quick tip for developers who use OS X

#323
post #250

Earlier quoted context omitted.

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 `!$`.

!$ runs the last command. it's bad if the last command is of the form command arg... because it'd run command without every other argument passed in the command line

Re: Quick tip for developers who use OS X

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

Indeed. It also works in things like irb, for example.

Re: Quick tip for developers who use OS X

#325

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 did this on my Mac a few years back and do it on Windows machine at work. I also use Hotkeys to swap alt and ctl to match my Mac.

Re: Quick tip for developers who use OS X

#326
Great tip, thanks.

Another useful fyi that I haven't seen anybody else mention is the Bash framework bash-it [https://github.com/revans/bash-it/]. It has tons of fantastic plugins, aliases and themes out of the box.

I've only tried it on iTerm2, but as it only replaces your .bash_profile file it should work fine on Terminal.

Re: Quick tip for developers who use OS X

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

you sure? it works for me in iterm2

Re: Quick tip for developers who use OS X

#329
post #219
post #201

Earlier quoted context omitted.

I wouldn't call it objective, but I've been using osx exclusively for 3 years now and shortcuts still come slower than windows, primarily because on windows I can press control and any key using just one hand by using my pinky for the control key.

I've found that lots of Windows converts haven't learned to use a thumb to hold the command key instead of a finger. Much easier to chord that way and you don't need to leave home position. It's easier for me than pinky-control since I have more dexterity in my thumbs.

I started using OS X about 6 months ago. Even though I am totally fine using the thumb now for pressing the command key, I do always feel as if I was moving an octave down on a piano keyboard (I used to learn when I was a kid).

Depending on where the control is on your keyboard (Windows vendors keep swapping FN and CTRL unfortunately, and rebinding might not be easy), I think the position of the hand is more natural - on the other hand, you might strain your pinky when pressing CTRL (or SHIFT) for long time and I haven't noticed that with using my thumb yet (and I doubt it will happen, given it is a much stronger finger).

Re: Quick tip for developers who use OS X

#330

A new one for me I accidentally found the other day.. If you use Spotlight to find something and then want to see the file in Finder, Cmd+click the item in the Spotlight dropdown. Edited from Cmd+shift+click due to note in child comment :-)

First thing I install on a Mac is Alfred. Check it out. `space` followed by name searches directories and files.
Post reply on HN