Как убрать зеленое выделение pycharm
Приёмы работы в PyCharm
Введение
PyCharm — интегрированная среда разработки для языка программирования Python. Предоставляет средства для анализа кода, графический отладчик, инструмент для запуска юнит-тестов и поддерживает веб-разработку на Django. PyCharm разработана компанией JetBrains на основе IntelliJ IDEA.
PyCharm — это кросс-платформенная среда разработки, которая совместима с Windows, macOS, Linux. PyCharm Community Edition (бесплатная версия) находится под лицензией Apache License, а PyCharm Professional Edition (платная версия) является проприетарным ПО.
Установка в Linux
Скачать с официального сайта jetbrains
Либо с помощью wget
Запустите JetBrains Toolbox
Примите JETBRAINS USER AGREEMENT
Выберите PyCharm Community или PyCharm Professional
Установить модуль в PyCharm
Рассмотрим как устанавливать дополнительные модули и библиотеки в PyCharm на примере requests
Перейдите в настройки проекта нажав
Найдите раздел Project: название вашего проекта
Выберите подраздел Project Interpreter или Python Interpreter
Нажмите на плюс в правой части экрана
Должно появиться окно Available Packages
Введите в стоку поиска название нужного модуля. В моём случае это requests
Нажмите кнопку Install Package
Дождитесь окончания установки
Дождитесь окончания установки
Pycharm: поставить курсор в начало нескольких строк подряд
Если нужно добавить или удалить что-то из нескольких срок, которые идут подряд
Поставьте курсор в нужное место самой верхней строки
Нажмите CTRL затем ещё раз CTRL и не отпускайте его. Нажмите стрелку вниз нужное количество раз.
Вертикальная линия ограничитель длины строки
Вертикальная линия после определённого числа символов помогает понять, что строка стала слишком длинной.
PEP 8 ограничивает длину 79 символами.
Limit all lines to a maximum of 79 characters.
For flowing long blocks of text with fewer structural restrictions (docstrings or comments), the line length should be limited to 72 characters.
Документация к Django рекомендует длину строки до 119 символов. Это связано с ограничением в GitHub
An exception to PEP 8 is our rules on line lengths. Don’t limit lines of code to 79 characters if it means the code looks significantly uglier or is harder to read.
We allow up to 119 characters as this is the width of GitHub code review; anything longer requires horizontal scrolling which makes review more difficult.
This check is included when you run flake8. Documentation, comments, and docstrings should be wrapped at 79 characters, even though PEP 8 suggests 72.
Популярный Python линтер Black ограничивает длину 88 символами.
Установить положение вертикальной линии в PyCharm можно в
File → Settings → Editor → Code Style → Hard wrap at
Разделить окно на две части
Разделить окно на две части можно разными способами
Половина слева, половина справа: выберите нужную вкладку → сделайте правый клик → Split Right
Половина снизу, половина сверху: выберите нужную вкладку → сделайте правый клик → Split Down
Чтобы просто перенести вкладку на новую половину экрана выберите Split and Move Right или Split and Move Down
Переключение из терминала
Чтобы быстро переключаться между терминалом и редактором кода можно воспользоваться следующим способом
Терминал будет скрыт если активен и появится если скрыт. Курсор автоматически переходит туда-сюда.
Убрать зеленый фон у кода в PyCharm
Если в код вставлен фрагмент на другом языке, PyCharm может подсветить его зелёным.
Если такого кода много, читать становится неприятно.
Особенно это актуально для Dockerfile
Решить проблему можно отключив подсветку в injected language fragment
Settings → Editor → Color Schema → General
injected language fragment
injected language fragment
Закомментировать выделенный код
Чтобы закомментировать выделенный код нажмите
Точно также выделенную область можно раскомментировать
Переименовать функцию в файле
Чтобы быстро переименовать функцию внутри файла выделите название функции и нажмите
Снизу справа появится превью. Изучите если нужно и нажмите Do Refactor снизу слева.
File Status Highlights
In PyCharm, each file is marked with a color according to its state in the version control you are using.
In the editor, each line in a file is checked for its version control state and is marked with a color in the gutter.
File status
To highlight folders and packages with modified contents, go to Settings/Preferences | Version Control | Confirmation and enable the Highlight directories that contain modified files in the Project tree option.

The file in the active changelist is scheduled for addition to the repository.

Added in not active changelist



The file is scheduled for deletion from the repository.

Deleted from file system
The file has been deleted locally, but hasn’t been scheduled for deletion, and it still exists in the repository.

Have changed descendants

Have immediate changed children

[Perforce, ClearCase, VSS] The file is modified without checkout.

A file is intentionally untracked by VCS.

The file is merged by your VCS as a result of an update.

Merged with conflicts
During the last update, the file has been merged with conflicts.

Merged with property conflicts
During the last update, the IDE has detected differences between the properties of the local file and its server version.

Merged with text and property conflicts
Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

The file has changed since the last synchronization.

Modified in not active changelist

The file should no longer be in your working copy of the repository.

Since the last update, the file has been renamed.

[SVN] The file is taken from a different branch than the whole project.

The file exists locally, but is not in the repository, and is not scheduled for addition.

The file hasn’t been changed.

The file in the active changelist is scheduled for addition to the repository.

Added in not active changelist



The file is scheduled for deletion from the repository.

Deleted from file system
The file has been deleted locally, but hasn’t been scheduled for deletion, and it still exists in the repository.

Have changed descendants

Have immediate changed children

[Perforce, ClearCase, VSS] The file is modified without checkout.

A file is intentionally untracked by VCS.

The file is merged by your VCS as a result of an update.

Merged with conflicts
During the last update, the file has been merged with conflicts.

Merged with property conflicts
During the last update, the IDE has detected differences between the properties of the local file and its server version.

Merged with text and property conflicts
Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

The file has changed since the last synchronization.

Modified in not active changelist

The file should no longer be in your working copy of the repository.

Since the last update, the file has been renamed.

[SVN] The file is taken from a different branch than the whole project.

The file exists locally, but is not in the repository, and is not scheduled for addition.

The file hasn’t been changed.

The file in the active changelist is scheduled for addition to the repository.

Added in not active changelist



The file is scheduled for deletion from the repository.

Deleted from file system
The file has been deleted locally, but hasn’t been scheduled for deletion, and it still exists in the repository.

Have changed descendants

Have immediate changed children

[Perforce, ClearCase, VSS] The file is modified without checkout.

A file is intentionally untracked by VCS.

The file is merged by your VCS as a result of an update.

Merged with conflicts
During the last update, the file has been merged with conflicts.

Merged with property conflicts
During the last update, the IDE has detected differences between the properties of the local file and its server version.

Merged with text and property conflicts
Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

The file has changed since the last synchronization.

Modified in not active changelist

The file should no longer be in your working copy of the repository.

Since the last update, the file has been renamed.

[SVN] The file is taken from a different branch than the whole project.

The file exists locally, but is not in the repository, and is not scheduled for addition.

The file hasn’t been changed.
Line status in the editor
To disable the colors, go to Settings/Preferences | Editor | General | Highlight modified lines in gutter and clear the necessary checkboxes.

Lines that have been modified since the last update.

Lines in which only whitespaces have been modified since the last update.

Lines that have been added since the last update.

Lines that have been removed since the last update.

Lines that have been modified since the last update.

Lines in which only whitespaces have been modified since the last update.

Lines that have been added since the last update.

Lines that have been removed since the last update.

Lines that have been modified since the last update.

Lines in which only whitespaces have been modified since the last update.

Lines that have been added since the last update.

Lines that have been removed since the last update.
Шпаргалка: Горячие (hotkeys) клавиши PhpStorm и PyCharm
Горячих клавиш в IDE PhpStorm и PyCharm гораздо больше, чем в приведенном ниже списке. Здесь я привел только те, которыми пользуюсь сам (* звездочкой выделил наиболее используемые мною горячие клавиши).
Шпаргалка будет обновляться, если начну использовать новые hotkeys.
Для настройки горячих клавиш или добавление собственных сочетаний клавиш перейдите File > Settings > Keymap.
Редактирование
*Ctrl + W — выделение текущего блока. Если нажимать W несколько раз, то будут выделяться родительские блоки по иерархии.
Ctrl + Shift + W — проделывает обратное действие от предыдущего
Ctrl + Y — удаляет строку
*Ctrl + D — дублирует строку
Ctrl + Shift + U — делает выделенный текст или заглавными, или строчными буквами
Ctrl + Delete — удаляет часть от курсора до конца слова
*Ctrl + Alt + L — форматирование кода соответствии с настройками code style.
*Ctrl + / — закомментировать/раскомментировать текущую строку.
Ctrl + Shift + / — закомментировать/раскомментировать выделенные строки кода.
Ctrl + Shift + J — к текущей строке присоединяет нижнюю.
Ctrl + [ или ] — перемещает курсор в начало или конец блока с кодом, в теле фукции, в теле цикла и т.д.
Ctrl + Shift + ] или [ — выделить код код до конца или до начала блока
*Tab — сделать отступ (табуляцию)
*SHIFT + Tab — убрать отступ
*Ctrl + Alt + Стрелка вверх — перемещает текущую строку вверх.
*Ctrl + Alt + Стрелка вниз — перемещает текущую строку вниз.
Ctrl + Shift + Стрелка вниз — перемещает текущий логический блок вниз
*Ctrl + Space — выводит возможные варианты автодополнения
Ctrl + курсор мыши над кодом — краткая информация
*Ctrl + клик по названию переменной или метода, или CTRL+B когда курсор установлен на названии, приведет туда, где метод или переменная определены.
*Ctrl + G — перейти к строке по номеру
*Alt + Клик левой кнопкой мышки — мультикурсор, если нужно одновременно несколько курсоров, кликаем мышкой в нужные места, куда нужно их добавить
*Ctrl + Alt + J — обрамление выделенного текста тегом (нужно выбрать первый пункт из всплывающего окошка)
F11 — быстро установить закладку
Shift + F11 — просмотр всех закладок
Поиск / замена
Двойной Shift — поиск по проекту
*Ctrl + F — поиск в текущем файле
*Ctrl + R — поиск и замена
*Ctrl+Shift+E — вызовет всплывающее окно, в котором показаны последние куски кода в разных файлах, с которыми вы работали
Ctrl + Shift + F — поиск в группе файлов (например в проекте или папке)
Ctrl + Shift + R — поиск и замена в группе файлов
Ctrl + N — найти в каком файле находится класс
*Ctrl + Shift + N — поиск файла по названию
Разное
Ctrl + Alt + S — быстрый доступ к настройкам
*Shift + F6 — переименование файла (выделите в блоке с файлами проекта нужный файл).











