LoginSignup
4
2

More than 1 year has passed since last update.

Xcodeでもcommand+enterで改行したい

Posted at

概要

今回の記事はXcodeのショートカットに関するものです。
command + enterでVSCodeと同じような改行を実現します。
VSCodeでcommand + enterを同時に押すと、カーソルが行の途中にあっても新しい行の先頭にカーソルが移動すると思います。

手順

  1. Xcodeキーバインディングの設定ファイルを編集する
  2. Xcodeの設定からキーを割り当てる

設定ファイルを編集する

設定ファイルは以下のパスにあります。

/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist

このファイルを以下のように修正します。

xml.plist
...
<!DOCTYPE ... 
<plist version="1.0">
<dict>
...
    <key>Custom Key Bindings</key>
    <dict>
      <key>insert new line(custom)</key>
      <string>moveToEndOfLine:, insertNewline:</string>
    </dict>
</dict>
</plist>

キーを割り当てる

Xcodeの設定からキーを割り当てます。
Preferences > Key Bindings から確認できます。
image2.png

この画面でcommand + enterを設定します。
他のショートカットキーとコンフリクトする場合はどちらかを別のキーに設定しましょう。

参考リンク

4
2
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
4
2