IntelliJ IDEA をインストールした後に毎回やる設定とプラグインを紹介します。IntelliJ IDEA がメジャーバージョンアップしたときにクリーンインストールしていますが、いつも設定を忘れてしまうのでメモ。
IntelliJ IDEA のバージョンは 2018.1
目次
- テキストを画面の幅に合わせて改行する
- ファイルの保存時に最終行に改行を自動挿入する
- スタイルも一緒にコピーする機能を無効にする
- スペースやタブを表示する
- 選択文字列をシングルクォートなどで囲む
- Deproyment の Options で Preserve files timestamps のチェックを外す
- キーマップ
- プラグイン
- おまけ 過去のバージョンのゴミを消す(Mac向け)
テキストを画面の幅に合わせて改行する
Settings/Preferences | Editor | General | Use soft wrap in editor にチェック

ファイルの保存時に最終行に改行を自動挿入する
Settings/Preferences | Editor | General | Ensure an empty line at file end of a file on Save にチェック

スタイルも一緒にコピーする機能を無効にする
Settings/Preferences | Editor | General | Copy as rich text by default のチェックをオフ

デフォルトの状態ではテーマの背景色などもコピーされます。文字だけをコピーするようにしています。
スペースやタブを表示する
Settings/Preferences | Editor | General | Appearance | Show whitespace にチェック

選択文字列をシングルクォートなどで囲む
Settings/Preferences | Editor | General | Smart Keys | Surround selection on typing quote or brace にチェック

Deproyment の Options で Preserve files timestamps のチェックを外す
上部メニューバーの Tools | Deproyment | Options | Preserve files timestamps のチェックを外す

デプロイ時に Failed to change timestamp of the file xxxx
のエラーが出ることがあるため。
キーマップ
ターミナルと同じような操作感にしています。毎回細かく設定するのはしんどいので基本デフォルトで変更は最小限に。
アクション | キーマップ |
---|---|
Debug | alt + d |
Delete | control + d |
Type Hierarchy | alt + h |
Backspace | control + h |
プラグイン
- String Manipulation
- 文字をエンコードしたりデコードしたり、改行を消したり、ソートしたり、いろいろできるプラグイン
- RegexpTester
- 正規表現をテストできるプラグイン
- AceJump
- コードの任意の場所の近くにジャンプできるプラグイン
- Save Actions
- 保存したときに特定のアクションを実行するプラグイン
- File Watchers
- 保存したときに特定のアクションを実行するプラグイン
おまけ 過去のバージョンのゴミを消す(Mac向け)
アップグレードを重ねているとゴミが溜まっていくので、以下のコマンドで定期的に掃除しています。AppCleaner アプリを使ってアンインストールするとゴミも含めてキレイに消してくれるので、そっちがオススメ。
$ find ~/Library/Caches -name '*IntelliJIdea*' -type d | xargs rm -rf
$ find ~/Library/Logs -name '*IntelliJIdea*' -type d | xargs rm -rf
$ find ~/Library/Application\ Support -name '*IntelliJIdea*' -type d -print0 | xargs -0 rm -rf
$ find ~/Library/Preferences -name '*IntelliJIdea*' -type d | xargs rm -rf