Skip to content

JetBrains IDEs

For the IDE warning that the inotify watch limit is too low. Check the current value first, because newer kernels may already default to 1048576:

Terminal window
sysctl fs.inotify.max_user_watches
echo 'fs.inotify.max_user_watches = 1048576' | sudo tee /etc/sysctl.d/idea.conf
sudo sysctl --system

Restart the IDE. Source: Inotify Watches Limit (Linux).

The Toolbox App and Tools | Create Desktop Entry create them for you. Write one by hand only for a manual tarball install, e.g. ~/.local/share/applications/jetbrains-phpstorm.desktop, with /opt/phpstorm pointing to the extracted directory:

[Desktop Entry]
Type=Application
Name=PhpStorm
Icon=/opt/phpstorm/bin/phpstorm.svg
Exec=/opt/phpstorm/bin/phpstorm.sh %f
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm

LightEdit mode as a separate application for single files, in ~/.local/share/applications/PhpStormLightEdit.desktop:

[Desktop Entry]
Type=Application
Name=PhpStorm LightEdit
Comment=Open files in PhpStorm LightEdit mode
Icon=/opt/phpstorm/bin/phpstorm.svg
Exec=/opt/phpstorm/bin/phpstorm.sh -e %F
MimeType=text/plain;
Terminal=false

Make it the default application for text files:

Terminal window
update-desktop-database ~/.local/share/applications
xdg-mime default PhpStormLightEdit.desktop text/plain

Custom watchers live in Settings | Tools | File Watchers.

Prints the values of path macros, so you can check them before using them in a real watcher. Set Program to printf and Arguments to (one line):

"%s\n" "FileDir: $FileDir$" "FileName: $FileName$" "FileNameWithoutExtension: $FileNameWithoutExtension$" "FileExt: $FileExt$" "FilePath: $FilePath$" "FileRelativePath: $FileRelativePath$" "ProjectFileDir: $ProjectFileDir$"

File Watcher dialog with the macro preview settings

File Watchers do not load your shell profile, so they don’t see Node.js installed by nvm. Add to the profile:

Terminal window
export NVM_SYMLINK_CURRENT=true

Open a new shell and run nvm use once. This creates ~/.nvm/current. In the watcher set (the IDE needs absolute paths):

Field Value
Program /home/user/.nvm/current/bin/npm
Arguments run my-script $FilePath$
Working directory $ProjectFileDir$
Environment variables PATH=/home/user/.nvm/current/bin:$PATH

The symlink follows the last nvm use in any shell, and several shells switching versions at once can race. See the nvm notes.

Patterns worth adding in Settings | Editor | File Types:

File type Patterns
Dockerfile Dockerfile.*
JSON *.json.dist, composer.lock
YAML *.yml.dist, *.yaml.dist