From 450983e33309cdd8b6ad3849ee86e8b5b3903706 Mon Sep 17 00:00:00 2001 From: Benjamin Wohlwend Date: Fri, 17 Aug 2018 17:44:55 +0200 Subject: [PATCH 1/1] added instructions for PyCharm File Watcher setup (#418) * added instructions for PyCharm File Watcher setup With these steps, PyCharm will run black on every file save. * Update README.md --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e360232..3becfd3 100644 --- a/README.md +++ b/README.md @@ -619,11 +619,22 @@ $ where black - Name: Black - Description: Black is the uncompromising Python code formatter. - Program: - - Arguments: $FilePath$ + - Arguments: `$FilePath$` 5. Format the currently opened file by selecting `Tools -> External Tools -> black`. - Alternatively, you can set a keyboard shortcut by navigating to `Preferences -> Keymap -> External Tools -> External Tools - Black`. +6. Optionally, run Black on every file save: + + 1. Make sure you have the [File Watcher](https://plugins.jetbrains.com/plugin/7177-file-watchers) plugin installed. + 2. Go to `Preferences -> Tools -> File Watchers` and click `+` to add a new watcher: + - Name: Black + - File type: Python + - Scope: Project Files + - Program: + - Arguments: `$FilePath$` + - Output paths to refresh: `$FilePathRelativeToProjectRoot$` + - Working directory: `$ProjectFileDir$` ### Vim -- 2.39.5