OSX - Tips and tricks

Terminal/iTerm: Delete key should delete

This really bugged me a lot. On a Mac, the delete key seems to have minor importance, but I just happen to use it in a terminal. All it does there is output a tilde (~) sign. Sad. So, on iTerm and i guess even on Terminal, you could map an escape sequence to it (0x04 will do it), but that does not work in vi. I believe the best option is to use the .inputrc or bindkey, since I use zsh now. In your ~/.inputrc: "\e[3~": delete-char or bindkey "\e[3~" delete-char.

In fact, those lines in ~/.zshrc seem to work well:

# Delete as delete
bindkey "\e[3~" delete-char
# CTRL-Left-Right jumps words
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word
# Home and end
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line

merge pdf

"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o out.pdf *.pdf

Open properties of multiple files

CMD-ALT-i - Really, this should be the default. Probably not until OS 12.10.

Turn off animations

Sometimes, you just don't want to wait for a transition.

defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
defaults write -g NSWindowResizeTime -float 0.001
defaults write -g QLPanelAnimationDuration -float 0
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write NSGlobalDomain NSWindowResizeTime .001

Hide Desktop icons

I have the tendency to dump a lot of stuff (like screenshots of progress and other very shady things) on my Desktop. I like how Gnome handles it: The Desktop does not display it's contents over the background image. OSX supports this, too:

#off
defaults write com.apple.finder CreateDesktop -bool false && killall Finder
#on
defaults write com.apple.finder CreateDesktop -bool true && killall Finder

Get rid of resource fork Icons recursively:

find . -name "Icon?" -print0 | xargs -0 rm

Karabiner

get it from https://pqrs.org/osx/karabiner/ .
Really, Karabiner is incredibly useful. As I have a regular 'PC' keyboard (pretty standard Filco one, no fancy keys), I like using the control key as CMD.

Someone might find my private.xml useful - This basically adds workarounds to sanely work with Maya, Houdini, Blender and in iTerm2. While not perfect yet, it more or less works.

<?xml version="1.0"?>
<root>

  <windownamedef>
    <name>Blender_Main</name>
    <regex>Blender</regex>
  </windownamedef>

  <appdef>
    <appname>MAYA</appname>
    <equal>com.autodesk.Maya.2014</equal>
    <equal>com.autodesk.Maya.2015</equal>
    <equal>com.autodesk.Maya.2016</equal>
    <equal>com.autodesk.Maya.2017</equal>
  </appdef>


  <appdef>
    <appname>ITERM</appname>
    <equal>com.googlecode.iterm2</equal>
  </appdef>

  <appdef>
    <appname>HOUDINI</appname>
    <equal>com.sidefx.HoudiniEscape</equal>
  </appdef>

 <appdef>
    <appname>VMWARE</appname>
    <equal>com.vmware.fusion</equal>
  </appdef>

   <appdef>
    <appname>BLENDER</appname>
    <equal>org.blenderfoundation.blender</equal>
  </appdef>

  <item>
    <name>Swap Control and Command</name>
    <identifier>private.contcomswap</identifier>
    <not>BLENDER,MAYA,ITERM,VMWARE,TERMINAL</not>
    <autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::COMMAND_L</autogen>
  </item>


  <item>
    <name>Blender fix</name>
    <identifier>private.windownamedef</identifier>
    <windowname_only>Blender_Main</windowname_only>
   <autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::COMMAND_L</autogen>
  </item>


  <item>
    <name>enable copy/paste in maya</name>
    <identifier>private.mayacopypaste</identifier>
    <only>MAYA</only>
    <autogen>
      __KeyToKey__
      KeyCode::C,ModifierFlag::CONTROL_L,
      KeyCode::C,ModifierFlag::COMMAND_L 
    </autogen>
    <autogen>
      __KeyToKey__
      KeyCode::V,ModifierFlag::CONTROL_L,
      KeyCode::V,ModifierFlag::COMMAND_L 
    </autogen>

      <autogen>
      __KeyToKey__
      KeyCode::Z,ModifierFlag::CONTROL_L,
      KeyCode::Z,ModifierFlag::COMMAND_L 
    </autogen>
  </item>


  <item>
    <name>Remap home/end</name>
    <identifier>private.revertiterm</identifier>
    <not>ITERM</not>
    <autogen>
      __KeyToKey__
      KeyCode::HOME,
      KeyCode::CURSOR_LEFT,ModifierFlag::COMMAND_L
    </autogen>
    <autogen>
      __KeyToKey__
      KeyCode::END,
      KeyCode::CURSOR_RIGHT,ModifierFlag::COMMAND_L
    </autogen>
    <autogen>__KeyToKey__ KeyCode::END, KeyCode::COMMAND_L</autogen>
  </item>
</root>