My Defaultkeybinding.dict For Mac
2020年10月27日Download: http://gg.gg/mrfr8
Since OS X supports custom key bindings, I looked for a way to fix this. The trick is to create a file called DefaultKeyBinding.dict in the KeyBindings folder inside your Library folder. You can use this file to override the default key bindings for most applications. Here are my changes. This documentation is generated automatically from the comments and commands in the DefaultKeyBinding.dict file. The script documentkeybindings.rb is free for use, but it’s specifically designed for use with my formatting in the bindings plist (i.e. It’s a little finicky). This project is maintained by ttscoff.By Xah Lee. Date: . Last updated: .
MacOS has a system-wide mechanism to let you define or modify the shortcut keys for text editing operations.
It lets you create keys to:
*Insert math symbols, emoji, or any template text.
*Move cursor by word, page up/down.
*Copy, cut, paste, undo, redo.
*select word, line, paragraph, select all.
*upcase word, lowercase word.
*new, open, save, etc.
*and more.Key Config File
Create a file at
~/Library/KeyBindings/DefaultKeyBinding.dict
Create the “KeyBindings” folder if you don’t already have it.
Copy and past the following:
Note: if you use Unicode Characters directly in the file such as♥, you must save the file using UTF-8 encoding.
Launch or restart TextEdit or other app to start to use your changes.
The syntax in general is this:
*keycode is a string that represents key press.
*actionCode represents what to do.Keycode SyntaxAction CodeUnicode Reference
If you want to create lots keys to insert math symbols or emoji, seeSample File
Example of defining the {Home, End} keys to move to the beginning/end of line.
Here’s example file for inserting Unicode characters with the ⌥option key.
Here’s a example ofErgoEmacs Keybinding, one for QWERTY layout and one forDvorak Keyboard Layout:
You can look at Xcode’s keybinding file at/Developer/Applications/Xcode.app/Contents/Resources/PBKeyBinding.dict.You can view it here: osx_keybinding_xcode.dict.txt.Emacs Keybinding
Mac OS X by default support emacs keybindings. They are:
*Ctrl+f → move forward
*Ctrl+b → move backward
*Ctrl+n → move down a line
*Ctrl+p → move up a line
*Ctrl+a → beginning of line
*Ctrl+e → end of line
*Ctrl+k → delete current position to end of line
*Ctrl+y → paste
You can add more of emacs’s
*Ctrl+space → set mark
*Ctrl+w → cut
*Ctrl+xCtrl+x → Swap cursor position to last mark
However, i don’t recommend it. Emacs’s keys is very inefficient and ergonomically painful.See: Why Emacs’s Keyboard Shortcuts are Painful.If you like a efficient keybinding for text editing, try:Emacs: Xah Fly Keys.Problems
Something this cannot do. For example:
*It cannot remap keys.
*It can’t set a key such as F8 to type other keys such as ⌘command+c.
*It can’t set a key to launch a app or script.
There are many solutions to these. See:Mac: Key Remapping, Keybinding Tools
Best is to get a programable keyboard. See:Programable Keyboards with Onboard Memory
See also:Problems of Mac OS X DefaultKeyBinding.dict.Reference
*Text System Defaults and Key Bindings By Apple. At https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html
*Technical Note TN2056: Installable Keyboard Layouts At https://developer.apple.com/library/mac/technotes/tn2056/_index.html
back toKeyboard Shortcut and Layout Tutorial
*amazon egift card to xah@xahlee.org , $20 is nice.
*paypal to xah@xahlee.org , $20 is nice.
*bitcoin me 19dfoa3Q7oehm9MwCULQzBG8vqfCaeMazH
If you have a question, put $5 at patreon and message me.
On this page:
*OverviewNews2015-06-29New release, now as a keylayout bundle that will show up as an English keyboard layout in System Preferences. Also, numerous additional characters: uscustom.2015-06-29.zip.2012-08-30New release, swapped compose (now §) and option deadkey (now ±, that is, ⇧+§): uscustom.2012-08-30.zip.2012-08-28New release, with compose key now additionally mapped to ⇧+^+F13: uscustom.2012-08-28.zip.2012-08-24New release, now with a compose key: uscustom.2012-08-24.zip.2010-08-20Initial release: uscustom.2010-08-20.zip!Rationale
The U.S. custom keyboard layout is for Mac OS X computers (I don’t exclude the possibility that there might be future releases for other systems, but currently I don’t have the knowledge). It has three main purposes:
*Have a compose key on Mac OS.
*Access option combos even when the physical option modifier is used for something else (e.g. as Meta/Alt in a terminal).
*Assign something useful (U.S. Extended) to capslock.
This keyboard layout is intended to be as unintrusive as Apple’s normal U.S. keyboard layout, but at the same time, even more powerful than Apple’s U.S. Extended keyboard layout – especially for developers and occasional IPA users.
I have developed this keyboard layout for my personal use. It is my default keyboard layout. Perhaps someone else might find it useful, too. Especially users of Apple’s U.S. Extended keyboard layout might find this keyboard layout easy to use.Compose key on Mac OS X
This keyboard layout implements the compose key on Mac OS X by using a keyboard layout (duh). There is another possibility that has been pointed out in a number of places: Customizing the Cocoa text system, that is, editing the file Library/KeyBindings/DefaultKeyBinding.dict (see Cocoa Text System by Jacob Rus, Compose key for OSX by Bob Kåres, Setting up a real compose key on Mac OS X by sam, or Mac OS X Keybinding Key Syntax by Xah Lee).
Both methods have their pros and cons:
Getting a compose key by modifying DefaultKeyBinding.dict works across different keyboard layouts, just as on Linux. However, it is limited to Cocoa applications. Customization is more straightforeward and better documented on the net. However, there is no UI for changing such a compose key.
Getting a compose key by a keyboard layout like U.S. custom works all over the OS. Its behaviour slightly differs from what you are used to on Linux. There is a visual feedback until the compose sequence is completed. I believe this is very helpful. However, when you interrupt the compose sequence (for instance, by hitting Backspace or by typing a character that does not fit in the compose sequence), the visual feedback is really typed.Installation
*Download and open uscustom.2012-08-30.zip (alternatively, go to Browse U.S. custom keyboard layout Files on SourceForge.net and choose a release).
*Move the files UScustom.keylayout and UScustom.icns to either one of the following folders:
*/Library/Keyboard Layouts/
*~/Library/Keyboard Layouts/
*Activate U.S. custom in the Input Sources tab of the Language & Text preference pane (in System Preferences), and then select it from the Input menu in the menu bar – its icon is a U.S. flag with a tiny C for «custom» or «compose»: .Where is the compose key?
The compose key is mapped to two different keys:
*If you have an ISO keyboard (not an ANSI keyboard which is common in the USA, compare the ISO keyboard English (International) and the ANSI keyboard English (USA) at How to identify keyboard localizations), then you will find the compose mapped to § (the key below Escape ⎋).
*Another instance of the compose key is mapped to ⇧+^+F13. This is the same mapping that has been chosen by sam at Setting up a real compose key on Mac OS X. If you want to remap the compose key to your right option modifier key ⌥, then you can exactly follow sam’s careful instructions for installation and setup of Takayama Fumihiko’s KeyRemap4MacBook.OverviewNormal mode (without capslock)No modifiers
The only difference from Apple’s U.S. keyboard layout is the compose key ⎄. The compose combos have been mostly copied from an Ubuntu 12.04 /usr/share/X11/locale/en_US.UTF-8/Compose (dropping combos that require which are not present on the U.S. keyboard layout and adding some).Shift
The only difference from Apple’s U.S. keyboard layout is the option deadkey ⌥ which allows typing characters that normally require the option modifier ⌥. This is especially useful for typing on Terminal.app where you will prefer the option modifier to behave like Meta ◆.
Example: Suppose you want to type ‹ß› (U+00DF, LATIN SMALL LETTER SHARP S) in Emacs. Normally, you would press ⌥+s. In Emacs, you cannot do this because you have set the option modifier to behave like a Meta, so when you press ⌥+s, Emacs understands ◆+s which does not produce ‹ß› at all, but the command center-line. This keyboard layout provides the additional option deadkey ⌥ which will produce a deadkey state that duplicates the effects of the option modifier. If you hit the option deadkey ⌥, release it, and then hit s, you will get ‹ß› – even in Emacs!Option
No difference from Apple’s U.S. keyboard layout – this is the same layout you get after having pressed the option deadkey ⌥:Option + Shift
No difference from Apple’s U.S. keyboard layout – this is the same layout you get after having pressed the option deadkey ⌥ and then using shift:Capslock mode
The capslock mode is similar to Apple’s U.S. Extended keyboard layout.Capslock (no other modifiers)
Without additional modifiers, the layout is the same as the normal U.S. keyboard layout except for the compose key ⎄ and a few regular keys behave like deadkeys. These deadkeys produce common accented keys, in a similar fashion like the US-International keyboard layout. I have deliberately decided to use other keys than the ones of the US-International keyboard. The US-International deadkeys have the advantage that they are mnemonic, but they have the disadvantage that they are likely to interfere with regular typing.
Example: Pressing the the US-International deadkey ’ followed by e produces ‹é› (U+00E9, LATIN SMALL LETTER E WITH ACUTE), but when you wish to type ‹class=’e’›, that deadkey interferes and converts the output into ‹class=é’›.
In order to avoid this problem, I have chosen deadkeys that are not normally followed by Latin letters. Of course, the problem persists, but I hope it will occur more seldom. The deadkeys I have chosen ar ; for umlaut and caron, ` for grave, , for circumflex and ] for acute:Capslock, Shift
The only difference from Apple’s U.S. keyboard layout is the option deadkey ⌥:Capslock, Option
While this is identical to Apple’s U.S. Extended keyboard layout (except for the ² deadkey), a significantly higher number of combos has been added. Also, they can be combined with each other. For instance, when you first hit the macron deadkey ˉ (⌥+A) and then the acute deadkey ´ (⌥+E), the next character will have both a macron and an acute.
Hitting Space after any diacritcs deadkey produces the combining character of that diacritic. Hitting ⇧+Space produces the corresponding spacing character.Capslock, Option + Shift
While this is identical to Apple’s U.S. Extended keyboard layout (except for the ³ deadkey), the multiple purpose deadkeys № and ʔ have been added many additional characters.
Example: Pressing the multiple purpose deadkey ʔ (⌥+⇧+.) followed by v (alternatively, the option deadkey ⌥ followed by ⇧+. followed by v) will produce ‹ʋ› (U+028B, LATIN SMALL LETTER V WITH HOOK).My Defaultkeybinding.dict For Mac Download
Another example: Pressing the multiple purpose deadkey № (⌥+⇧+;) followed by ⌥+⇧+’ (alternatively, the option deadkey ⌥ followed by ⇧+; followed by the option deadkey ⌥ followed by ⇧+’) will produce ‹ˌ› (U+02CC, MODIFIER LETTER LOW VERTICAL LINE).
At the moment, I have no overview of all the characters that can be produced by the multiple purpose deadkeys №, ʔ, ², and ³. I suggest using Apple’s keyboard viewer. As a rule of thumb, № produces alternate forms, ʔ produces alternate forms with hooks, and ³ produces some arrows.KeyFixer - Fix Your OS X Home And End KeysContactSee Full List On Xahlee.info
You can reach me through e-mail at: j_maREMch_OVEwuTHISst@sharedTEXT-files.de.Mac Defaultkeybinding.dict
You may also want to check out my sourceforge user web: j. ‘mach’ wust’s sourceforge user web.
Download: http://gg.gg/mrfr8
Since OS X supports custom key bindings, I looked for a way to fix this. The trick is to create a file called DefaultKeyBinding.dict in the KeyBindings folder inside your Library folder. You can use this file to override the default key bindings for most applications. Here are my changes. This documentation is generated automatically from the comments and commands in the DefaultKeyBinding.dict file. The script documentkeybindings.rb is free for use, but it’s specifically designed for use with my formatting in the bindings plist (i.e. It’s a little finicky). This project is maintained by ttscoff.By Xah Lee. Date: . Last updated: .
MacOS has a system-wide mechanism to let you define or modify the shortcut keys for text editing operations.
It lets you create keys to:
*Insert math symbols, emoji, or any template text.
*Move cursor by word, page up/down.
*Copy, cut, paste, undo, redo.
*select word, line, paragraph, select all.
*upcase word, lowercase word.
*new, open, save, etc.
*and more.Key Config File
Create a file at
~/Library/KeyBindings/DefaultKeyBinding.dict
Create the “KeyBindings” folder if you don’t already have it.
Copy and past the following:
Note: if you use Unicode Characters directly in the file such as♥, you must save the file using UTF-8 encoding.
Launch or restart TextEdit or other app to start to use your changes.
The syntax in general is this:
*keycode is a string that represents key press.
*actionCode represents what to do.Keycode SyntaxAction CodeUnicode Reference
If you want to create lots keys to insert math symbols or emoji, seeSample File
Example of defining the {Home, End} keys to move to the beginning/end of line.
Here’s example file for inserting Unicode characters with the ⌥option key.
Here’s a example ofErgoEmacs Keybinding, one for QWERTY layout and one forDvorak Keyboard Layout:
You can look at Xcode’s keybinding file at/Developer/Applications/Xcode.app/Contents/Resources/PBKeyBinding.dict.You can view it here: osx_keybinding_xcode.dict.txt.Emacs Keybinding
Mac OS X by default support emacs keybindings. They are:
*Ctrl+f → move forward
*Ctrl+b → move backward
*Ctrl+n → move down a line
*Ctrl+p → move up a line
*Ctrl+a → beginning of line
*Ctrl+e → end of line
*Ctrl+k → delete current position to end of line
*Ctrl+y → paste
You can add more of emacs’s
*Ctrl+space → set mark
*Ctrl+w → cut
*Ctrl+xCtrl+x → Swap cursor position to last mark
However, i don’t recommend it. Emacs’s keys is very inefficient and ergonomically painful.See: Why Emacs’s Keyboard Shortcuts are Painful.If you like a efficient keybinding for text editing, try:Emacs: Xah Fly Keys.Problems
Something this cannot do. For example:
*It cannot remap keys.
*It can’t set a key such as F8 to type other keys such as ⌘command+c.
*It can’t set a key to launch a app or script.
There are many solutions to these. See:Mac: Key Remapping, Keybinding Tools
Best is to get a programable keyboard. See:Programable Keyboards with Onboard Memory
See also:Problems of Mac OS X DefaultKeyBinding.dict.Reference
*Text System Defaults and Key Bindings By Apple. At https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html
*Technical Note TN2056: Installable Keyboard Layouts At https://developer.apple.com/library/mac/technotes/tn2056/_index.html
back toKeyboard Shortcut and Layout Tutorial
*amazon egift card to xah@xahlee.org , $20 is nice.
*paypal to xah@xahlee.org , $20 is nice.
*bitcoin me 19dfoa3Q7oehm9MwCULQzBG8vqfCaeMazH
If you have a question, put $5 at patreon and message me.
On this page:
*OverviewNews2015-06-29New release, now as a keylayout bundle that will show up as an English keyboard layout in System Preferences. Also, numerous additional characters: uscustom.2015-06-29.zip.2012-08-30New release, swapped compose (now §) and option deadkey (now ±, that is, ⇧+§): uscustom.2012-08-30.zip.2012-08-28New release, with compose key now additionally mapped to ⇧+^+F13: uscustom.2012-08-28.zip.2012-08-24New release, now with a compose key: uscustom.2012-08-24.zip.2010-08-20Initial release: uscustom.2010-08-20.zip!Rationale
The U.S. custom keyboard layout is for Mac OS X computers (I don’t exclude the possibility that there might be future releases for other systems, but currently I don’t have the knowledge). It has three main purposes:
*Have a compose key on Mac OS.
*Access option combos even when the physical option modifier is used for something else (e.g. as Meta/Alt in a terminal).
*Assign something useful (U.S. Extended) to capslock.
This keyboard layout is intended to be as unintrusive as Apple’s normal U.S. keyboard layout, but at the same time, even more powerful than Apple’s U.S. Extended keyboard layout – especially for developers and occasional IPA users.
I have developed this keyboard layout for my personal use. It is my default keyboard layout. Perhaps someone else might find it useful, too. Especially users of Apple’s U.S. Extended keyboard layout might find this keyboard layout easy to use.Compose key on Mac OS X
This keyboard layout implements the compose key on Mac OS X by using a keyboard layout (duh). There is another possibility that has been pointed out in a number of places: Customizing the Cocoa text system, that is, editing the file Library/KeyBindings/DefaultKeyBinding.dict (see Cocoa Text System by Jacob Rus, Compose key for OSX by Bob Kåres, Setting up a real compose key on Mac OS X by sam, or Mac OS X Keybinding Key Syntax by Xah Lee).
Both methods have their pros and cons:
Getting a compose key by modifying DefaultKeyBinding.dict works across different keyboard layouts, just as on Linux. However, it is limited to Cocoa applications. Customization is more straightforeward and better documented on the net. However, there is no UI for changing such a compose key.
Getting a compose key by a keyboard layout like U.S. custom works all over the OS. Its behaviour slightly differs from what you are used to on Linux. There is a visual feedback until the compose sequence is completed. I believe this is very helpful. However, when you interrupt the compose sequence (for instance, by hitting Backspace or by typing a character that does not fit in the compose sequence), the visual feedback is really typed.Installation
*Download and open uscustom.2012-08-30.zip (alternatively, go to Browse U.S. custom keyboard layout Files on SourceForge.net and choose a release).
*Move the files UScustom.keylayout and UScustom.icns to either one of the following folders:
*/Library/Keyboard Layouts/
*~/Library/Keyboard Layouts/
*Activate U.S. custom in the Input Sources tab of the Language & Text preference pane (in System Preferences), and then select it from the Input menu in the menu bar – its icon is a U.S. flag with a tiny C for «custom» or «compose»: .Where is the compose key?
The compose key is mapped to two different keys:
*If you have an ISO keyboard (not an ANSI keyboard which is common in the USA, compare the ISO keyboard English (International) and the ANSI keyboard English (USA) at How to identify keyboard localizations), then you will find the compose mapped to § (the key below Escape ⎋).
*Another instance of the compose key is mapped to ⇧+^+F13. This is the same mapping that has been chosen by sam at Setting up a real compose key on Mac OS X. If you want to remap the compose key to your right option modifier key ⌥, then you can exactly follow sam’s careful instructions for installation and setup of Takayama Fumihiko’s KeyRemap4MacBook.OverviewNormal mode (without capslock)No modifiers
The only difference from Apple’s U.S. keyboard layout is the compose key ⎄. The compose combos have been mostly copied from an Ubuntu 12.04 /usr/share/X11/locale/en_US.UTF-8/Compose (dropping combos that require which are not present on the U.S. keyboard layout and adding some).Shift
The only difference from Apple’s U.S. keyboard layout is the option deadkey ⌥ which allows typing characters that normally require the option modifier ⌥. This is especially useful for typing on Terminal.app where you will prefer the option modifier to behave like Meta ◆.
Example: Suppose you want to type ‹ß› (U+00DF, LATIN SMALL LETTER SHARP S) in Emacs. Normally, you would press ⌥+s. In Emacs, you cannot do this because you have set the option modifier to behave like a Meta, so when you press ⌥+s, Emacs understands ◆+s which does not produce ‹ß› at all, but the command center-line. This keyboard layout provides the additional option deadkey ⌥ which will produce a deadkey state that duplicates the effects of the option modifier. If you hit the option deadkey ⌥, release it, and then hit s, you will get ‹ß› – even in Emacs!Option
No difference from Apple’s U.S. keyboard layout – this is the same layout you get after having pressed the option deadkey ⌥:Option + Shift
No difference from Apple’s U.S. keyboard layout – this is the same layout you get after having pressed the option deadkey ⌥ and then using shift:Capslock mode
The capslock mode is similar to Apple’s U.S. Extended keyboard layout.Capslock (no other modifiers)
Without additional modifiers, the layout is the same as the normal U.S. keyboard layout except for the compose key ⎄ and a few regular keys behave like deadkeys. These deadkeys produce common accented keys, in a similar fashion like the US-International keyboard layout. I have deliberately decided to use other keys than the ones of the US-International keyboard. The US-International deadkeys have the advantage that they are mnemonic, but they have the disadvantage that they are likely to interfere with regular typing.
Example: Pressing the the US-International deadkey ’ followed by e produces ‹é› (U+00E9, LATIN SMALL LETTER E WITH ACUTE), but when you wish to type ‹class=’e’›, that deadkey interferes and converts the output into ‹class=é’›.
In order to avoid this problem, I have chosen deadkeys that are not normally followed by Latin letters. Of course, the problem persists, but I hope it will occur more seldom. The deadkeys I have chosen ar ; for umlaut and caron, ` for grave, , for circumflex and ] for acute:Capslock, Shift
The only difference from Apple’s U.S. keyboard layout is the option deadkey ⌥:Capslock, Option
While this is identical to Apple’s U.S. Extended keyboard layout (except for the ² deadkey), a significantly higher number of combos has been added. Also, they can be combined with each other. For instance, when you first hit the macron deadkey ˉ (⌥+A) and then the acute deadkey ´ (⌥+E), the next character will have both a macron and an acute.
Hitting Space after any diacritcs deadkey produces the combining character of that diacritic. Hitting ⇧+Space produces the corresponding spacing character.Capslock, Option + Shift
While this is identical to Apple’s U.S. Extended keyboard layout (except for the ³ deadkey), the multiple purpose deadkeys № and ʔ have been added many additional characters.
Example: Pressing the multiple purpose deadkey ʔ (⌥+⇧+.) followed by v (alternatively, the option deadkey ⌥ followed by ⇧+. followed by v) will produce ‹ʋ› (U+028B, LATIN SMALL LETTER V WITH HOOK).My Defaultkeybinding.dict For Mac Download
Another example: Pressing the multiple purpose deadkey № (⌥+⇧+;) followed by ⌥+⇧+’ (alternatively, the option deadkey ⌥ followed by ⇧+; followed by the option deadkey ⌥ followed by ⇧+’) will produce ‹ˌ› (U+02CC, MODIFIER LETTER LOW VERTICAL LINE).
At the moment, I have no overview of all the characters that can be produced by the multiple purpose deadkeys №, ʔ, ², and ³. I suggest using Apple’s keyboard viewer. As a rule of thumb, № produces alternate forms, ʔ produces alternate forms with hooks, and ³ produces some arrows.KeyFixer - Fix Your OS X Home And End KeysContactSee Full List On Xahlee.info
You can reach me through e-mail at: j_maREMch_OVEwuTHISst@sharedTEXT-files.de.Mac Defaultkeybinding.dict
You may also want to check out my sourceforge user web: j. ‘mach’ wust’s sourceforge user web.
Download: http://gg.gg/mrfr8
コメント