PyCharm makes it possible to set up line separators (line endings) for the newly created files, and change line separator style for the existing files.
In this section:
- Setting up line separators for newly created files
- Viewing line ending style for the current file
- Changing line separator for a file, currently opened in the editor
- Changing line separator for a selection in the Project view
- Tips and tricks
- In Settings, click Code Style.
- From the Line separator (for new files) drop-down list, select the desired line separator style:
- Apply changes and close the dialog.
- Open the desired file in the editor, as described in the section Opening and Reopening Files.
- View the Status bar: the current line endings style is denoted by the dedicated icon with the specified style, for example,
.
- Open the desired file in the editor, as described in the section Opening and Reopening Files.
- Do one of the following:
- Click the line separator spin box in the Status bar, and choose the desired line ending style from the pop-up menu:
- Choose on the main menu, and then choose the desired line ending style from the sub-menu.
- Click the line separator spin box in the Status bar, and choose the desired line ending style from the pop-up menu:
- Select a file or directory in the Project tool window.
Note that if a directory is selected, the line ending style applies to all nested files recursively.
- Choose
Tips and tricks
- Use multiple selection in the Project view.
- Changing line separator is reflected in the Local history of a file.
- Run the inspection 'Inconsistent line separators' to find out, which files use line separator different from project's default