LoginSignup
5
5

More than 5 years have passed since last update.

macOS Sierraでコロンとセミコロンを入れ替える

Last updated at Posted at 2017-06-09

macOS Sierraでコロンとセミコロンが入れ替えられなくて困っているVimmerの皆さん!特に特別なアプリケーションを入れずともコロンとセミコロンを入れ替えることができましたよ。

ご存知の通り、現状macOS SierraではKarabinerが動作しません。移行措置として用意されたKarabiner Elementsは使えるのですが、残念ながらコロンとセミコロンが入れ替えられません。これは一部のVimmerにとっては辛いです。
僕も困っていたのですが、macOSというかCocoaの仕組みとしてキーバインディングの変更ができるので、それを使って入れ替えることができました。

具体的には、~/Library/KeyBindings/DefaultKeyBinding.dictに下記の行を追加すればOKです。

{
";" = ("insertText:", ":");
":" = ("insertText:", ";");
}

ちなみに反映にはアプリケーションの再起動が必要になる場合があるようです。再起動しちゃうのが早いかも。

この方法は下記のリンクで発見しました。
https://github.com/tekezo/Karabiner-Elements/issues/26#issuecomment-304770126

キーバインディングについてのApple公式ドキュメントはこちら
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html

こちらにも解説と幾つかサンプルがあります。
http://xahlee.info/kbd/osx_keybinding.html

余談ですがキーリピートの速度もコマンドラインから変更できます。これで、キーリピートのためにKarabiner Elementsを入れる必要もなくなります。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5