LoginSignup
23

More than 5 years have passed since last update.

Xcodeで一行削除ショートカットを使う

Last updated at Posted at 2014-07-12

普段SublimeTextで一行削除ショートカットを使用していたのでXcodeでもできないかと調べていたら

http://www.funky-monkey.nl/blog/2014/02/adding-keybindings-in-xcode-5/

という記事を見つけたので、ほぼ一緒の内容ですが手順を説明します。

1. Xcodeを終了する

Xcodeを終了しないまま作業を行うとうまく行かない事があるようです。

2. ターミナルでResourcesフォルダを開く

open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources

3. Finderの検索で IDETextKeyBindingSet.plist ファイルを検索

IDETextKeyBindingSet.plist

4. ファイルと親フォルダの権限の修正

ファイルと親フォルダがロックされているため、右クリックでファイルと親フォルダの情報を開き「everyone」の権限を「読み/書き」にします。

5. キー設定の追加

Rootに customized キーをDictionaryタイプで追加します。

続いて customized キーの中に

Key
Delete Current Line
Value
deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:

をStringタイプで追加して、ファイルを閉じます。

もしくは、IDETextKeyBindingSet.plist を直接 OSX標準のテキストエディットで開いて、

<plist version="1.0">
<dict>
...

<key>customized</key>
    <dict>
        <key>Delete Current Line</key>
        <string>deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:</string>
    </dict>

...
</dict>

のように変更したあと上書き保存します。
... は省略を表しています。

6. XCodeを開く

XCodeを開きます。

7. キー設定

Preferences から Key Bindings を選択し、範囲が All となっていることを確認して検索バーから Delete Current Line と入力し検索し、好きなショートカットを設定したら完了です。

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
23