4

I have a bunch of keyboard shortcuts setup for Pages, Keynote, and several other programs. Is there a way to export and then import these shortcuts? I just reformatted my home computer and am now going through the painful process of re-creating all the shortcuts.

Paul Irish's dotfiles got me thinking about this: https://github.com/paulirish/dotfiles

  • Could you explain why Paul Irish's dotfiles made you think about that or pinpoint the actual code you are referring to? – Gerry Oct 9 '12 at 12:45
3

It depends on how you have defined the shortcut keys. The files responsible for storing these preferences are in the usual place: ~/Library/Preferences

You could simply move the files that store the preferences over to the new Mac:

  • com.apple.symbolichotkeys.plist
  • com.apple.universalaccess.plist
  • com.apple.iWork.Keynote.plist
  • com.apple.iWork.Pages.plist

If you were good at parsing JSON or XML, you could do the export to a text file as well using the plutil tool.

  • I've defined the shortcuts via the System Preferences > Keyboard panel. Should/can I do this via a text editor? That'd be better for sure. – saltcod Oct 9 '12 at 13:50
  • The big thing is that application shortcuts go into the app preference file and system wide ones, the system pref file. You can use PlistBuddy and plutil to systematically convert a text file into property list additions as well as to issue defaults write commands to append them. This is advanced scripting, but doable for a DIY hacker. – bmike Oct 9 '12 at 13:52
1

The shortcuts for sandboxed applications are stored in ~/Library/Containers/*/Data/Library/Preferences/*.plist. The shortcuts for all applications are in ~/Library/Preferences/.GlobalPreferences.plist. You could probably just copy the preference files from the old account.

I use a shell script like this to configure the shortcuts in the old-style property list format. You can print the current settings with defaults read.

defaults write -g NSUserKeyEquivalents '{
"Back" = "@\UF702";
"Go Back" = "@\UF702";
"Forward" = "@\UF703";
"Go Forward" = "@\UF703";
"Minimize" = "\0";
}'

defaults write com.apple.finder NSUserKeyEquivalents '{
"Show Package Contents" = "@\r";
}'
  • Note that defaults read will return escaped "\\"s in shortcuts (e.g. defaults read com.apple.finder NSUserKeyEquivalents after the above command will return …"@\\r"…). Because defaults write automatically escapes "\", the doubled "\\"s from the defaults read output will have to be cut down to the single "\"s seen in the above examples before you can reapply them (e.g. on your new computer) with defaults write – henry Mar 14 '18 at 20:31
-1

The above answer is too complicated. With Keynote 9 (v 5.3) and Mountain Lion, and assuming that the format bar is visible, you can simply define a key in Keyboard Shortcuts panel of the Keyboard System Preference:

  1. Select "Application Shortcuts", and click the + icon
  2. Select the Keynote application.
  3. For the Menu Title type the font name exactly as it appears in the format bar. I entered "Times New Roman".
  4. Type the shortcut key (I used Option+Command+R).
  5. Quit Keynote and restart it.
  6. Select some text and type the shortcut key. The font will change to Times New Roman.
  • How does this at all answer the OP's question about exporting and importing a set of all shortcuts for "several programs". I think you didn't fully read or understand the question. – hepcat72 Oct 30 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .