3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PhpStormで『GotoFileでクォート文字列のファイル名を送る』マクロ

Posted at

PhpStormでマクロを初めて使ってみたけど便利な使い方出来て、思ってたより色々捗りそう。

CakePHPとかのフレームワークを使ってると、テンプレート→別テンプレートに飛ぶことが多くて、その度にファイル名入力してジャンプするけど若干煩わしい。

そんなわけで、『GotoFileアクションにシングルクォーテーション内のファイル名を送る』マクロを作ってみた。

※以下はIdeaVimプラグインを入れてVimキーバインドになっている想定です。

f:id:rinrin900:20130306191546p:plain

設定手順

手順は以下の通り。

  1. [Edit]-[Macro]-[Start Macro Recording]を選択

  2. エディタ上に任意の箇所で[vi']-[Ctrl+Shift+A(GotoFile)]の順に入力

  3. [Edit]-[Macro]-[Stop Macro Recording]を選択

  4. 任意のマクロ名を指定して保存

これでマクロが完成。

次に、作成したマクロに任意のショートカットを割り当てる。

f:id:rinrin900:20130306192027p:plain

使い方

ジャンプしたいファイル名が書かれているシングルクォート内で、先ほど作成したマクロを実行するだけ。

f:id:rinrin900:20130306192239p:plain

f:id:rinrin900:20130306192357p:plain

こんな感じ。
ちなみに、GotoFileの代わりにGotoClassとか指定すれば、クラス名指定でのジャンプが出来るようになるはず。

PhpStorm上のエディタ機能だけでなく、自前でインストールしたプラグインとも組み合わせてマクロが組めるみたい。
頻繁にやる操作をマクロ化しておけば効率も桁違いに上がるはずなので、積極的につかってみようとおもう。

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?