I'd like to run a script when a file gets saved. (It's an automatic git commit in the vein of git-wip). It's related to Save actions in IntelliJ IDEA, but it mostly attracted answers about code reformatting. It was also asked 3 years ago. The only snippet I found was http://arhipov.blogspot.hu/2011/04/code-snippet-intercepting-on-save.html. So I wonder if things have changed and now it's easy to add a save-hook.
Press Ctrl+S or select File | Save All from the main menu.
Run applications Last modified: 28 July 2022. Run a class with a main() method: Shift+F10. You can run applications right from IntelliJ IDEA if you have an SDK set up for your project/module.
In File > Settings > Appearance & Behavior > System Settings, under Synchronization, do you have checked the option of "Save files automatically if application is idle for xxxx sec." ? Why not disable it totally? My version of IntelliJ IDEA has a check-mark on this option that when unchecked it disables it.
You can run a process with ⌃R (macOS), or Shift+F10 (Windows/Linux). To stop a process, you can use ⌘F2 on macOS, or Ctrl+F2 on Windows/Linux.
I think you have at least two options:
Use the File Watchers plugin from JetBrains:
NB: Doesn't work on IntelliJ Idea 11.
Use a similar program outside of IntelliJ. I'm using fswatch (works on Unix-based OSes, including OSX) installed via MacPorts (port install fswatch):
https://github.com/emcrisostomo/fswatch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With