Skip to content

Instantly share code, notes, and snippets.

@tsmith512
Created November 30, 2012 04:33
Show Gist options
  • Save tsmith512/4173789 to your computer and use it in GitHub Desktop.
Save tsmith512/4173789 to your computer and use it in GitHub Desktop.
My iJourney

An Introduction

Through both a yearning for familiarity and the knowledge that corporate computer defenestration is a terminal act, I have arduously forged this list of tips, less useful for those on a quest to be an ultimate iUser than for those who want to retain a glimpse, however fleeting, of the Windows/Linux they used to know.

-- tsmith512

Software

Things I've Installed

  • CheatSheet -- See all available hotkeys by holding cmd. Very handy if launched on login.
  • Harvest -- Internal time tracker
    • cmd opt m -- Show timesheet
    • cmd opt n -- Add new time entry (start timer or write-in duration)
  • Alfred -- Quick launcher with many other features. Download from their website, not the App Store, for more features and the optional Powerpack.
    • opt space -- Open Alfred prompt
  • Sublime Text 2, $59 -- My new favorite text editor ever. See notes below.
  • Flow, $5 -- Pretty great SFTP/FTP file manager. Trying as an alternative to Transmit.
  • Docker -- Move the dock and change various features, and most importantly: disable bouncing dock icons.
  • Unarchiver -- A possible replacement for the sucky 'Archive Utility'
  • Homebrew -- A package manager for common linux utilities. Requires Xcode. You can brew install anything you might want to apt-get install and it's awesome.
  • Spectacle.app -- An alternative to SizeUp for management of Windows using Windows 7-esque hotkeys to snap windows to screen areas. Free!!

Stuff I'd Like to Try Out

  • Witch, $14 -- Mac OS's cmd tab switches between applications, cmd ` switches within windows of a single application. Witch provides a better and unified window switching approach without the slugish and mouse-only Exposé.
  • TotalFinder, $18 -- "Fixes" the Finder by adding tabs, dual-pane, folders on top, cut/paste files
  • Path Finder, $40 -- Apparently like TotalFinder plus bookmarks, queues, batch operations, git/svn, tagging, hex edit, archive support, temporary drop stack, and more...
  • HyperDock, $10 -- Bring Aero Peek (hover over app in dock to see open windows), and window snap zones to Mac OS
  • 1Password -- A password manager. I've loved and used KeePass 2 for years. KeePassX is available but can only read KeePass 1 files and in beta to read/write KeePass 2 files. I'd skip KeePass 2 on Mac OS using Mono. Sucks! 1Password has finally released betas for Windows and Android, so this might be my new cross-platform solution, which is essential.
  • SecondBar -- Add a menubar to the secondary display when using an external display to avoid the crappy window-on-one and menu-on-the-other annoyance.
    • (Immediate impression: Kinda works for Adobe CS products, which will maximize underneath the bar... Also does some weird things when locking the screen and prevents the SecondBar monitor from powering off when idle.)

The Reject Bin

Didn't care for these, but you might:

  • Transmit, $34 -- Great (S)FTP manager, still not sure if I'm going to pull the trigger on this or not.
  • Cyberduck -- SFTP/FTP (and other protocols) remote file manager, donation-ware that seems as full-featured as Transmit.
    • (Immediate impression: lacks 2-panel interface, laggy and slow... Also, be sure to check the permissions preferences on uploads.)
  • Moom, $10 -- Instead of SizeUp, with similar features and a few extras. Seems more polished. Cheaper.
    • (Although definitely more powerful than SizeUp, also a little more complex to use. Operation flow is multi-stepped: open Moom then perform operation. They do get major bonus points for adding a vertisile menu attached to the mediocre green 'zoom' button in the titlebar. Lastly, demo is limited to 100 usages, which goes by quickly.)
  • Quicksilver -- Quick launcher like Alfred, but better.
    • (Good, but more powerful than I needed. Stuck with Alfred)
  • SourceTree -- DVCS client from Atlassian. Git/hg/svn. Seems neat.
    • (Registration is required, but free. Very polished UI, good visual client for anyone wanting GUI tools for git commands or a better branch architecture visual that GH provies. I'm gonna stick with the commandline, though.)
  • SizeUp, $13 -- Move windows between screens, maximize, center, and split with the keyboard like in Windows 7.

Tips and Tweaks

General Mac OS

IMHO, Mac OS goes a little too far with font smoothing resulting in text that is too blurry. Font smoothing can be reduced without being turned off, which results in crisper edges with an overall lighter weight.

Execute in terminal:

  • The fix: defaults -currentHost write -globalDomain AppleFontSmoothing -int 1
  • The restore: defaults -currentHost delete -globalDomain AppleFontSmoothing

Levels 1 through 3 are valid, 0 disables smoothing entirely. 2 is the default. The restore command removes the user-level setting, falling back to the system-wide default value.

Home/End and Shift + Home/End, on Linux and Windows, move to/select to the beginning or end of the current line. Mac OS default is the beginning or end of the entire textarea/document. For the PC maneuver, append the following to the file ~Library/KeyBindings/DefaultKeyBinding.dict (which may or may not exist):

{
  "\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
  "\UF72B"  = "moveToEndOfLine:";                         /* End          */
  "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
  "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */
}

This doesn't work everywhere, most notably in Skype (which retains native behavior).

Tab to Form Elements:

By default, tab cycles through text boxes and lists only. To use tab to access all form controls:

  1. Open System Preferences → Keyboard
  2. Go to "Shortcuts"
  3. Under "Full Keyboard Access," select "All Controls"

Trackpad "Natual" Scrolling Direction:

Recently, both Mac and Windows started mapping default trackpad scrolling in "natural" direction: Swipe up moves the page up (scrolls down). Swipe down moves the page down (scrolls up). This is how it works on a touch display, but seems stupid on a trackpad. To change:

  1. Open System Preferences → Trackpad
  2. Go to "Scroll & Zoom"
  3. Uncheck "Scroll direction: natural"

It's probably my headphones, but even with volume on its lowest accessible setting using the volume up/down keys, it's crazy loud. If you need more granular control of the volume, you can execute:

osascript -e "set Volume 0.1"

The scale is 0 to 7; decimals may be used.

See that gist for a super long list of defaults commands for system tweks. It is designed to be run as a script, but I wouldn't want all of them. I especially liked these:

  • Expand the 'Save' panel by default:
    defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
  • Expand the 'Print' panel by default:
    defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
  • Screenshots of windows (cmd+ctl+4 spc to save or cmd+ctl+shift+4 spc to copy) include surrounding whitespace and a large drop-shadow. To clip the window only at its edges:
    defaults write com.apple.screencapture disable-shadow -bool true then
    killall SystemUIServer
  • Disable the character accent menu in favor of traditional key repetition (avoid this if you use international characters often and don't want to use the option key combinations for accents):
    defaults write -g ApplePressAndHoldEnabled -bool false
    Restart may be required. Set to false to re-enable accent menu.

Hot Keys:

I still use my external keyboard from my PC. If you do, too, remember these:

  • Windows Key (win) → Command Key (cmd)
  • Alt Key (alt) → Option Key (opt)
  • Control Key (ctl) → Control Key (ctl)
  • The Order Changes: PC Keyboard ctl, win, alt → Mac Keyboard ctl, opt, cmd

So if you want to... (pet peeves and tricky ones only)

...do this: Which Was: It's Now:
Switch Applications alt tab cmd tab
Switch Windows (w/in Application) alt tab cmd `
Open File (Most Apps) enter cmd o
Rename Something (Most Apps) ctl r / F2 enter
Delete File (Finder) delete cmd delete
Find & Launch (á la Start Menu) win cmd space
Close Tab (or window if none/last) ctl w cmd w
Quit Application (they'll fool ya) alt F4 / ctl q cmd q
Simple Screenshot to Clipboard print screen cmd ctl shift 3
Region Screenshot to Clipboard cmd ctl shift 4
Window Movement win shift arrows Try SizeUp / Moom
Path with Tab Completion (Finder) cmd G
Prev / Next Tabs (like in Browser) cmd shift [ / ]

To access the menubar using arrow keys and letters, use ctl fn F2 (fn is only required if you aren't using standard functions keys, like on a MacBook keyboard). "Hot-letters" won't be underlined, but the first letter of any word will highlight that option, in order of appearance.

Finder

  • Execute in Terminal and Killall Finder to Activate:
  • View → Status Bar
  • View → Path Bar
  • Preferences → Sidebar -- To select which items are shown
  • Preferences → Advanced → Show all filename extensions
  • Better yet, TotalFinder or Path Finder?

Terminal

In Preferences "Settings" → "Keyboard" change these keybindings using the "Send String to Shell" option. Copy/paste in or hit escape before typing:

Home Beginning of Line \001
End End of Line \005
Page Up Send Page Up (not Page Up in Terminal Buffer) \033[5~
Page Down Send Page Up (not Page Up in Terminal Buffer) \033[6~

My Theme (xterm-esque):

  • Start with "Pro"
  • Set typeface: Andale Mono, 13pt
  • Disable antialiasing (Andale Mono is a screen typeface which lines up properly on pixels, it shouldn't be antialiased lest it appear blurry. Looks so much better this way.)
  • With the "Pro" theme selected, click the 'Default' button so that "New Terminal Window" opens a Pro window.
  • In the "Startup" preferences tab, select to open a new window with "Pro" settings for when Terminal.app is launched.

My Prompt:

The default terminal prompt is hostname:dirname username$ , which I find a little backward. My Ubuntu default is a colorized user@host:path$ . To use that:

  1. nano ~/.bash_profile
  2. Insert export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
  3. Either source ~/.bash_profile or close and re-open Terminal.

I also put version control in my prompt, like this:
[git:repo:branch] user@host:path$

(Note: This works on Ubuntu, but on Terminal.app using Bash, it doesn't refresh the prompt each time, so you get stale version control info. Researching...)

To add that:

  1. Download the binary from vcprompt using the instructions displayed in README.
  2. nano ~/.bash_profile
  3. Prepend the prompt (PS1) with
    $(~/bin/vcprompt -f "[%s:%P:%b%a%m%u] ")
  4. Adjust paths and arguments as necessary. Test the command by running vcprompt from a Git, Mercurial, or Subversion working directory.
  5. source ~/.bash_profile a couple times. It didn't immediately take effect for me.

Also Useful:

  • Use byobu, a fantastic GNU Screen manager, already installed on dev1. Set to launch on login so you retain sessions between connections.
    • F2: New screen tab
    • F3: Previous tab
    • F4: Next tab
    • F8: Rename active
    • F9: Byobu Settings
    • C-a |: Split vertically
    • C-a S: Split horizontally
    • C-a Q: Close split (tabs remain open)

Adobe CS Products

Not even going to try to compare hotkeys. My condolences. This part sucks the most.

Application Frame:

I enjoy the Windows-esque container for all the windows, panels, and toolbars because there are so many. To wrap all of that in an "Application Frame," in each:

  1. Open Photoshop, Illustrator, or InDesign (and maybe others)
  2. Activate "Window" $rarr; "Application Frame"
  3. Activate "Window" $rarr; "Application Bar"

Sublime Text 2

An incredible editor.

My Preferences File:

Be sure to put your overrides in the user preferences file, not the global. However, reading the global file is great for finding options.

{
  "rulers": [80, 120],               // 80 and 120-Char Column Guides
  "font_face": "Andale Mono",        // To match Terminal
  "font_size": 13,
  "font_options": ["no_antialias"],  // See discussion on this in Terminal.
  "tab_size": 2,                     // PHP/Drupal Standards, if applicable
  "translate_tabs_to_spaces": true,
  "highlight_line": true,            // Tint the current line background
  "remember_open_files": false,      // Don't restore sessions (Transmit and WinSCP
                                     // use temp files when working remotely anyway)
  "hot_exit": false,                 // Prompt before exiting, dump session on exit.
                                     // Else ST saves session and changes for reoepn.
  "open_files_in_new_window": false, // Prevent multiple windows when opening new files
  "default_line_ending": "system"    // LF line endings only. (Which is a Mac default
                                     // but I use this on Windows, too.)
}

Useful Extras:

  • Package Control -- Quick install and management of community plugins
    • Emmet: An awesome web development toolkit
      • Rapid prototyping by expansion of CSS selectors into HTML code:
        header>h1#logo+div#search>form>input^^^nav>ul>li*5>a{Item $}
        will auto-expand into the full HTML you'd expect from this string.
      • Never had a problem on Windows, but on Mac this will occasionally hang and crash ST2... It should re-open session with unsaved changes. If you have trouble, be sure to set hot_exit to true in your settings to ensure changes are retained in a crash.
    • Hayaku: Powerful CSS abbreviation expansion
    • Alignment: Auto-align components of multi-line selections. Place cursors, and press cmd ctl a to align them horizontally with spaces.
    • Sass: Syntax highlighting and suggestions for SASS/SCSS
    • Drupal: Snippets and suggestions for Drupal API
    • SFTP: (S)FTP(S) plugin for remote browsing and file operations.
      • (I don't actually use this. I "live" edit out of an FTP client.)
    • Gist: Github Gist support, used in writing this file. Pretty sweet.

My Most Used Hotkeys:

Needless to say, this is a rapidly evolving list... Source 1 (Mac) Source 2 (PC)

Basic File Ops

Function Mac PC (In Case)
Open Function List cmd P ctl P
Open Console ctl ` ctl `
Open File cmd o ctl o
Save File cmd s ctl s
Goto Anything [Open] cmd p ctl p

Buffer Navigation

Function Mac PC
Goto Line ctl g ctl g
Goto Matching Bracket ctl m ctl m
Find cmd f ctl f
Highlight Duplicates of Selection cmd d ?

Editing

Function Mac PC
Duplicate (Selection or Current Line) cmd D ctl D

See Also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment