开发者

creating macros in intellij

I am trying to create a macro that takes a selection of text and runs some find/replace on it using a regex. I have rec开发者_运维技巧orded this macro in intellij, but when I run it, all I get is the find/replace dialog opened. No find/replace is executed.

Has anyone had any luck with creating a find/replace macro in intellij?


I can't get get the macro find/replace to work either but I can give you two things that might solve your problem:

  1. If it is only a few places/times you need to do it find/replace has memory of earlier replacements (arrow down in search/replace fields).

  2. Write a plugin (yes seriously it is not hard at all) to do this. I was surprised how easy it was, even though the documentation could be improved.

And a bonus way of doing it, I just thought of:

  1. Open the file in Emacs record replacing macro (or write an elisp function to do it), this is the way I would have done it until I learned how easy it was to make Idea plugins.


This appears to be a long-standing bug in IntelliJ. One workaround that worked for me was this:

  • Install the IdeaVim plugin.
  • When recording a macro requiring searching, enable Vim mode (Tools -> Vim Emulation) during the macro, position the cursor using standard Vim measures, disable Vim mode.

In general, Vim emulation can be really handy for IntelliJ macros.


If all else fails, tou could try AutoIT, AutoHotKey, Applescript or other general-purpose macro systems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜