как поменять терминал в intellij idea windows
Terminal
IntelliJ IDEA includes an embedded terminal emulator for working with your command-line shell from inside the IDE. Use it to run Java tools, Git commands, set file permissions, and perform other command-line tasks without switching to a dedicated terminal application.
Open the Terminal tool window
By default, the terminal emulator runs with the current directory set to the root directory of the current project. For information about changing the default start directory, see Configure the terminal emulator.
Alternatively, you can right-click any file (for example, in the Project tool window or any open tab) and select Open in Terminal from the context menu to open the Terminal tool window with a new session in the directory of that file.
Start a new session
To run multiple sessions inside a tab, right-click the tab and select Split Vertically or Split Horizontally in the context menu.
The Terminal saves tabs and sessions when you close the project or IntelliJ IDEA. It preserves tab names, the current working directory, and even the shell history.
Press Alt+Right and Alt+Left to switch between active tabs. Alternatively, you can press Alt+Down to see the list of all terminal tabs.
To rename a tab, right-click the tab and select Rename Session from the context menu.
Configure the terminal emulator
Project Settings
These settings affect the terminal only for the current project:
Start directory | Specify the working directory where every new shell session should start. By default, it starts in the root directory of the current project. |
Environment variables | Specify custom environment variables for every new shell session. |
Application Settings
These settings affect the terminal in any project that you open with the current IntelliJ IDEA instance.
Specify the shell that will run by default. IntelliJ IDEA should automatically detect the default shell based on your environment. Here are some examples of different shells:
Bash for Windows: bash.exe
Command Prompt: cmd.exe
Integrate the terminal with the system shell to properly keep track of your command history for sessions and load a custom config file with required environment variables.
Detect and highlight commands that can be used as IDE features instead of running them in the terminal and reading console output.
For the Python interpreter being a virtual environment, with this checkbox selected, the virtual environment is automatically activated ( activate is performed automatically).
This option is available only if you have the Python plugin installed.
The embedded terminal emulator also inherits the following IDE settings:
On the Keymap page, you can configure the copy Ctrl+C and paste Ctrl+V shortcuts.
On the Editor | General | Appearance page, you can configure blinking frequency for the caret. The Terminal does not inherit the Use block caret option because there is a separate option for that: Cursor shape.
On the Editor | Color Scheme | Console Font page, you can configure line spacing and fonts.
On the Editor | Color Scheme | Console Colors page, you can configure font colors.
On the Editor | Color Scheme | General page, you can configure the selection foreground and background colors.
Run IDE features from the terminal
Instead of running a specific command in the integrated terminal and reading console output, you can use the relevant IDE feature, like a tool window or a dialog that implements this functionality. For example, the diff viewer actually runs the diff command in the system shell to produce results. Another example is the Log tab in the Git tool window, which is based on the output of the git log command.
Open the Log tab of the Git tool window from the terminal
Type a supported command in the terminal and notice how it is highlighted.
How to open two terminal windows in IntelliJ IDEA, PyCharm?
Is it possible to open two terminal windows in IntelliJ IDEA (or in any other IDE based on it, like PyCharm)?
9 Answers 9
In case of terminal toolbar status, you can do one of these options
Also after that you can drag them as tabs and let them be side by side.
You can open multiple tabs and then use the mouse drag them out into the editor area. Then you may want to split the editor vertically to have two consoles side by side. Or you could use one terminal in the tool window and the other up in the editor area.
Besides the great answer given by avb (using the + or right click), you can of course also use a hotkey for this (when selected the terminal) press:
Windows / Linux: Ctrl + T
Note: you can even rename tabs by double clicking on their label.
This worked for me in IntelliJ Idea.
Click the plus icon to open a second terminal window
If you want to split the windows so both shows at the same time, just right-click on the second tab and select horizontal or vertical
Hope it helped someone.
You can drag terminal tabs into editor view and then use standard horizontal/vertical split to position them wherever you want them.
It’s a bit hack since the editor then considers your terminal window a file and names it Local or Local(x) if you have multiple.
Also note, that since IDE considers it a file, you cannot just split the view to get a new instance of terminal. You would have to use the terminal view to create a new tab and then again drag it to the designated area.
This is how it looks:
Using the Terminal in IntelliJ IDEA
Read this post in other languages:
Français
In this video we’re going to take a look at IntelliJ IDEA’s built in terminal. This performs the same function as your operating system’s terminal or command feature, but using the terminal inside IntelliJ IDEA has a number of benefits.
Opening the IntelliJ IDEA Terminal Window
In this example we have a simple Spring Boot application that needs a running MongoDB database. We can open the terminal window with ⌥F12 on macOS, or Alt+F12 on Windows and Linux. The terminal supports all the same commands that the operating system supports.
If we want to start the MongoDB database instance with a specific path for storing the data, we can type:
and press enter. When MongoDB is running in the terminal session, we can go back to writing the application code in the editor. By using the built in terminal, we don’t have to switch between applications, and we can easily have all aspects of our development right in front of us in the same window.
Multiple Terminal Sessions
We can open a second terminal tab with ⌘T on macOS, or Ctrl+Shift+T on Windows and Linux, to run the MongoDB shell as a new command:
Then we can interact with the server that’s running, and check everything is OK for our application.
Running commands in different tabs is helpful, but sometimes two different processes are closely related and we want to see them together. For this, we can split our terminal window so that we can run two in the same window. For example, you can open up the mongo shell in this split window and can see if the commands have any impact on the running server.
Naming Terminal Tabs
We can run any type of command from the terminal window. For example, although IntelliJ IDEA has full integration with Gradle, sometimes we might want to check a build tool like Gradle or Maven runs correctly from the command line. We might sometimes do this with different Java versions or different arguments to those we’re using in the application. Given that we might be using a number of terminal sessions with a number of different processes or parameters, it’s useful to rename the tabs to something helpful. You can do this from the context menu, which you can open by right-clicking on the tab. That way we can easily reopen the one we’re interested in.
We can move between the different tabs with ⌘⇧[ or ⌘⇧] on macOS or Alt+← or Alt+→ on Windows and Linux. We can switch between the splits with ⌥⇥ on macOS, or Ctrl+Tab on Windows and Linux. We can close splits or tabs with ⌘W on macOS, or Ctrl+F4 for Windows and Linux.
When we restart IntelliJ IDEA, our terminal session names and other settings will persist.
Pasting Code from the Editor into the Terminal
Running command line processes from inside IntelliJ IDEA is useful for keeping us in the same context while we’re developing, and for sharing content between different parts of our application. For example, if we’re running the Java REPL JShell in an IntelliJ IDEA terminal window, it’s easy to copy code from the editor and paste it into JShell. This is not specific to running JShell in the terminal, it’s easy to copy and paste code from anywhere in IntelliJ IDEA into the terminal window.
View steps in video
Terminal Locations from the Command Window
The integration provided by the IDE also extends to being able to open a location from inside the project window in the terminal window from the context menu. Right click on an item in the Project Window, for example, and select «Open in Terminal». This means that we can have a terminal window in the correct location immediately without having to navigate using the command line.
URLs and Stack Traces in the Terminal Window
URLs in the terminal window are clickable, so we can click on any link shown in the terminal window to open them in the browser. File names in the terminal can also link back to the file in the project. In stack traces, you can click on the file name and IntelliJ IDEA will open the file and put the caret on the line that caused the problem. This takes some of the pain out of debugging problems.
Run IDE Features from the Terminal
You may notice that some commands in the terminal window are highlighted. This is a new feature in IntelliJ IDEA 2020.2 that shows that the command could be run in the IDE, meaning we don’t need to use the command line.
If it’s highlighted in yellow and we press Enter, the command will be run in the terminal window just as we’d expect. If we type the same command again, but this time use ⌘⏎ on macOS, or Ctrl+Enter on Windows and Linux, IntelliJ IDEA will use the feature in IntelliJ IDEA and open the relevant tool window.
IntelliJ IDEA detects a number of different commands that could be run in the IDE instead of from the command line. For example, the git command:
will execute normally if we press Enter. If we press ⌘⏎ on macOS, or Ctrl+Enter on Windows and Linux, it opens the Git log window in IntelliJ IDEA.
This is a great way to discover features in the IDE that are an alternative approach to using the command line. If we decide we’re not going to need these suggestions, we can turn off «Run IDE Features from the Terminal» from the terminal window’s settings using the context menu. The commands will no longer be highlighted.
Summary
IntelliJ IDEA’s terminal window is a powerful and helpful tool for developers. It keeps our attention in the same tools which reduces context switching. It makes it easy for us to share things between the editor and the command line. The terminal is integrated allowing us to easily move from the project code to the terminal and back again, and it also can show us alternative ways of doing the same thing, using the IDE’s version of the command line tool.
Как открыть два окна терминала в IntelliJ IDEA, PyCharm?
Можно ли открыть два окна терминала в IntelliJ IDEA (или в любой другой IDE на основе этого, например PyCharm)?
ОТВЕТЫ
Ответ 1
В случае состояния панели инструментов терминала вы можете выполнить одну из этих опций
Также после этого вы можете перетащить их в виде вкладок и позволить им быть рядом.
Ответ 2
Ответ 3
Помимо отличного ответа от avb (с помощью + или правого клика), вы также можете использовать горячую клавишу для этой (при выборе терминала) печати:
Windows/Linux: Ctrl + T
Примечание: вы можете даже переименовать вкладки, дважды щелкнув их ярлык.
Ответ 4
Ничего себе, я обнаружил, что прямо сейчас, решение приходит из PyCharm 2016.3 Help: Щелкните правой кнопкой мыши заголовок вкладки и выберите «Изменить ориентацию разделителя» в контекстном меню.
Ответ 5
Вы можете перетащить вкладки терминала в представление редактора, а затем использовать стандартное горизонтальное/вертикальное разделение, чтобы расположить их там, где вы хотите.
Это немного хакерство, так как редактор затем считает ваше окно терминала файлом и называет его Local или Local(x) если у вас их несколько.
Также обратите внимание, что, поскольку IDE считает это файлом, вы не можете просто разделить представление, чтобы получить новый экземпляр терминала. Вам придется использовать вид терминала, чтобы создать новую вкладку, а затем снова перетащить ее в обозначенную область.
Вот как это выглядит:
Ответ 6
Перед перемещением переименуйте вкладку терминала в окне терминала. Затем имя сохраняется вместо «Местный»
Записки программиста
Краткая шпаргалка по сочетаниям клавиш в IntelliJ IDEA
Как ранее уже сообщалось, я начал активно изучать возможности IntelliJ IDEA. В частности, я стараюсь запомнить наиболее востребованные хоткеи, чтобы выполнять большую часть работы, не отрывая руки от клавиатуры, как это происходит при программировании в Vim. По моим наблюдениям, это реально экономит кучу времени. Я сделал для себя шпаргалку по хоткеям IDEA, которую вы найдете под катом. Полагаю, она также пригодится кому-то из посетителей данного блога.
Примечание: Те же сочетания клавиш работают и в других продуктах JetBrains, например, PyCharm и CLion.
Ниже не приводятся общеизвестные и очевидные сочетания вроде Ctr+C, Ctr+V или Ctr + S. В IntelliJ IDEA многие хоткеи имеют парный хоткей отличающийся только тем, что в нем дополнительно участвует клавиша Shift. Обычно она добавляет в том или ином виде выделение текста. Например, Ctr + End переводит курсор в конец файла, а Ctr + Shift + End выделяет код от текущей позиции до конца файла. Догадаться о существовании парных хоткеев несложно, поэтому далее они не приводятся. Наконец, если в любом диалоге IntelliJ IDEA вы видите подчернутые буквы, знайте, что сочетание Alt + буква равносильно использованию соответствующего контрола (обычно кнопок). Например, быстро запушить код в репозиторий можно путем нажатия Ctr + K, Alt + I, Alt + P, а затем снова Alt + P.
Итак, основные сочетания следующие.
Редактирование:
Окна, вкладки:
Alt + влево/вправо | Перемещение между вкладками |
Ctr + F4 | Закрыть вкладку |
Alt + циферка | Открытие/закрытие окон Project, Structure, Changes и тд |
Ctr + Tab | Switcher, переключение между вкладками и окнами |
Shift + Esc | Закрыть активное окно |
F12 | Открыть последнее закрытое окно |
Ctr + колесико | Zoom, если он был вами настроен |
Закладки:
F11 | Поставить или снять закладку |
Ctr + F11 | Аналогично с присвоением буквы или цифры |
Shift + F11 | Переход к закладке (удаление — клавишей Delete) |
Ctr + Число | Быстрый переход к закладке с присвоенным числом |
Подсказки и документация:
Ctr + Q | Документация к тому, на чем сейчас курсор |
Ctr + Shift + I | Показать реализацию метода или класса |
Alt + Q | Отобразить имя класса или метода, в котором мы находимся |
Ctr + P | Подсказка по аргументам метода |
Ctr + F1 | Показать описание ошибки или варнинга |
Alt + Enter | Показать, что нам предлагают «лампочки» |
Поиск:
Дважды Shift | Быстрый поиск по всему проекту |
Ctr + Shift + A | Быстрый поиск по настройкам, действиям и тд |
Alt + вниз/вверх | Перейти к следующему/предыдущему методу |
Ctr + [ и Ctr + ] | Перемещение к началу и концу текущего скоупа |
Ctr + F | Поиск в файле |
Ctr + Shift + F | Поиск по всем файлам (переход — F4) |
Ctr + F3 | Искать слово под курсором |
F3 / Shift + F3 | Искать вперед/назад |
Ctr + G | Переход к строке или строке:номеру_символа |
Ctr + F12 | Список методов с переходом к их объявлению |
Ctr + E | Список недавно открытых файлов с переходом к ним |
Ctr + Shift + E | Список недавно измененных файлов с переходом к ним |
Ctr + H | Иерархия наследования текущего класса и переход по ней |
Ctr + Alt + H | Иерархия вызовов выбранного метода |
Ctr + N | Поиска класса по имени и переход к нему |
Ctr + Shift + N | Поиск файла по имени и переход к нему |
Ctr + B | Перейти к объявлению переменной, класса, метода |
Ctr + Alt + B | Перейти к реализации |
Ctr + Shift + B | Определить тип и перейти к его реализации |
Shift + Alt + влево | Перемещение назад по стеку поиска |
Shift + Alt + вправо | Перемещение вперед по стеку поиска |
F2 / Shift + F2 | Переход к следующей / предыдущей ошибке |
Shift + Alt + 7 | Найти все места, где используется метод / переменная |
Ctr + Alt + 7 | Как предыдущий пункт, только во всплывающем окне |
Генерация кода и рефакторинг:
Ctr + Space | Полный автокомплит |
Ctr + Shift + Space | Автокомплит с фильтрацией по подходящему типу |
Alt + / | Простой автокомплит по словам, встречающимся в проекте |
Ctr + I | Реализовать интерфейс |
Ctr + O | Переопределить метод родительского класса |
Ctr + J | Генерация шаблонного кода (обход по итератору и тд) |
Ctr + Alt + J | Обернуть выделенный код в один из шаблонов |
Alt + Insert | Генератор кода — сеттеров, зависимостей в pom.xml и тд |
Shift + F6 | Переименование переменной, класса и тд во всем коде |
Ctr + F6 | Изменение сигнатуры метода во всем коде |
F6 | Перемещение метода, класса или пакета |
F5 | Создать копию класса, файла или каталога |
Shift + F5 | Создать копию класса в том же пакете |
Alt + Delete | Безопасное удаление класса, метода или атрибута |
Ctr + Alt + M | Выделение метода |
Ctr + Alt + V | Выделение переменной |
Ctr + Alt + F | Выделение атрибута |
Ctr + Alt + C | Выделение константы (public final static) |
Ctr + Alt + P | Выделение аргумента метода |
Ctr + Alt + N | Инлайнинг метода, переменной, аргумента или константы |
Ctr + Alt + O | Оптимизация импортов |
Прочее:
Понятное дело, в этой шпаргалке названы далеко не все возможности IntelliJ IDEA. Всем заинтересованным лицам я настоятельно рекомендую вот прямо брать и читать ее замечательную документацию, там очень много интересного. Жаль только, что документация не доступна в виде одного большого PDF файла.
Дополнение: В последних версиях IDEA можно использовать несколько курсоров, разместив их либо при помощи комбинации Alt+Shift+ЛКМ, либо вертикальным выделением при помощи клика средней клавишей мыши. Держа на вооружении сочетание Ctr + влево/вправо, осуществляющего переход между словами, а также другие, можно очень удобно редактировать сразу несколько строк кода.