KARABINER-ELEMENTS 自分用 設定2 MS製品で emacs キーバインド

以前に、かな漢字変換のキーとか、リターンキーを設定するためのキーバインドを紹介しましたが、別件です。
MS製品をMacOSで使う機会があったものの、あまりにも邪悪なキーバインドで、自分にはまともに使う事ができませんでした。
仕方なく、最小限のキーを Karabiner-elements で使えるような設定を作ってみました。
OneNoteだと、^A, ^E はなぜかデフォルトの動きをするんですね…。恐ろしい子。

ファイル名: 2.json

{
	"title": "MS製品 de Emacs key",
	"rules": [
		{
			"description": "MS-Office de Emacs key",
			"manipulators": [
				{ "type": "basic",
				  "from": { "key_code": "b", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "left_arrow" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "f", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "right_arrow" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "p", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "up_arrow" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "n", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "down_arrow" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "a", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "home" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\.Word$",
												"^com\\.microsoft\\.Excel$",
												"^com\\.microsoft\\.Powerpoint$" ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "e", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "end" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\.Word$",
												"^com\\.microsoft\\.Excel$",
												"^com\\.microsoft\\.Powerpoint$" ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "h", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "delete_or_backspace" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "d", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "delete_forward" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "w", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "x", "modifiers": [ "left_command" ] } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "w", "modifiers": { "mandatory": [ "left_option" ] } },
				  "to": [ { "key_code": "c", "modifiers": [ "left_command" ] } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "y", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "v", "modifiers": [ "left_command" ] } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "i", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "tab" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "m", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "return_or_enter" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "v", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "page_down" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "v", "modifiers": { "mandatory": [ "option" ] } },
				  "to": [ { "key_code": "page_up" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "g", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "escape" } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "/", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "z", "modifiers": [ "left_command" ] } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] },
				{ "type": "basic",
				  "from": { "key_code": "_", "modifiers": { "mandatory": [ "control" ] } },
				  "to": [ { "key_code": "z", "modifiers": [ "left_command" ] } ],
				  "conditions": [ { "type": "frontmost_application_if",
									"bundle_identifiers": [ "^com\\.microsoft\\." ] } ] }
			]
		}
	]
}

Karabiner-Elements complex_modifications のサイトに、”Emacs key bindings”という設定ファイルも置いてあるのですが、こちらは「MS製品以外も有無を言わさず変更」という感じでした。
自分的には今のところそんなに困っていなかったので、使う範囲で設定した感じです。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください