Tips & Tricks
Double Shift to Search Everywhere
Read this post in other languages:
As a user of IntelliJ IDEA, you may often find yourself wanting to increase your productivity by limiting the use of your mouse in your daily work.
With IntelliJ IDEA, you really only have to know a basic set of shortcuts, since you can use the Search Everywhere window to access anything you need.
For example, you can search for shortcuts that you don’t remember, actions you rarely use in your work, or actions that don’t have shortcuts assigned to them. Search Everywhere can also help you access main menu actions, tool windows, and settings.
Press Shift twice to open the Search Everywhere window, and then just enter your query to search inside your project. By the way, you can include non-project items in your search if you’d like to see, for example, search results from external libraries.
When IntelliJ IDEA opens the Search Everywhere window, it conveniently shows you a list of recent files that you can access.
You can change the scope of your search by switching between tabs to view the results from classes, files, symbols, or actions.
You can access the main menu actions right from the Search Everywhere window by typing the name of the menu option in the search field.
Let’s say, for example, that you work in distraction-free mode and want to exit IntelliJ IDEA. Type “exit” in the search field and hit Enter.
You can access any tool window by typing its name as your search query.
You can also browse a list of settings without leaving the working environment. Just type “/” before the query, and the Search Everywhere window will show you the groups of settings.
You can enable or disable options in the settings without leaving the Search Everywhere window. Enter a name or use groups of settings to locate the option you want to toggle, select the option in the list of the search results, and use the ON/OFF control keys. By the way, you can achieve the same outcome with plugins if you type “/plugins “ in the search field – this will give you a list of plugins in the search results which you can enable or disable.
Sometimes, the settings’ option you are looking for may have been moved to a different location. With the Search Everywhere window, you can keep track of those relocations since IntelliJ IDEA displays the paths to the listed options. Additionally, you can access those options right from the window.
When you find an action that doesn’t have a shortcut assigned to it, you can assign your own right from the Search Everywhere window. Type the name of the action in the search field, press Alt + Enter, and enter the shortcut in the Keyboard Shortcut dialog.
Search Everywhere can save you a lot of time, increase your productivity, and help you learn new shortcuts. All you need is to press Shift twice.
Happy Developing!
Subscribe to Blog updates
Вот новичок, который использует Python3 без написания Python3. Пожалуйста, содержим много и легко распылите его.
Python3 управляется PymySQL, код выглядит следующим образом [из учебника Cainiao]:
#!/usr/bin/python3
import pymysql
# Откройте подключение к базе данных: адрес, имя пользователя, пароль, имя базы данных
db = pymysql.connect("IP -адрес конфиденциально", "Конфиденциально имени пользователя", "Конфиденциальность пароля", «Имя базы данных конфиденциально»)
# Используйте метод Cursor () для создания курсора объекта курсора
cursor = db.cursor()
# Используйте метод execute () для выполнения SQL -запроса
cursor.execute("SELECT VERSION()")
# Используйте метод fetchone (), чтобы получить единые данные
data = cursor.fetchone()
print("Database version : %s " % data)
# Close Batabase Connection
db.close()
1. Нет модуля под названием PymySQL
Первая ошибка, которая появилась:
Сначала проверьте, существует ли PymySQL в командной строке:pip3 install PyMySQL
Дисплей командной строки:Requirement already satisfied: PyMySQL in c:\users\admin\appdata\local\programs\python\python37\lib\site-packages (0.9.3)
Это показывает, что PymySQL уже должен существовать.
Решение заключается в следующем:
Новые проекты проверяют наследство глобальных пакетов на сайтах и делают доступность для всех проектов. Скопируйте код еще раз, то есть больше не появляется в этой ошибке
2. Не могу бежать
Установлено, что приведенный выше код не может быть запущен напрямую. Поэтому скопируйте базовый код в код шаблона, предоставленный Pycharm. Код обновляется следующим образом:
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import pymysql
#ДВА -линейные пространства между функциями и функциями должны быть
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
def db_connect():
# Откройте подключение к базе данных: адрес, имя пользователя, пароль, имя базы данных
db = pymysql.connect("IP -адрес конфиденциально", "Конфиденциально имени пользователя", "Конфиденциальность пароля", «Имя базы данных конфиденциально»)
# Используйте метод Cursor () для создания курсора объекта курсора
cursor = db.cursor()
# Используйте метод execute () для выполнения SQL -запроса
cursor.execute("SELECT VERSION()")
# Используйте метод fetchone (), чтобы получить единые данные
data = cursor.fetchone()
print("Database version : %s " % data)
# Close Batabase Connection
db.close()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
db_connect()
print_hi('PyCharm')
Нажмите на зеленый треугольник слева, чтобы успешно работать.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. |
I wasn’t aware of the double-shift until I read your comment. Thanks much for teaching me something new today!
I use Control+N to search for classes mostly. To run and to stop. I have extra keys on my keyboard that I’m able to run macros. One of them runs the program currently visible in PyCharm (Control+Alt+R). Another one stops it if pressed once or stops everything if pressed twice (Control+F2).
For running most of my PySimpleGUI Demo Programs, I use the Demo Program Browser (launches using another single-key).
Anyway, thanks for the great tip.
Motivation : There is a project code in the Windows local system, which needs to be uploaded to the server and run the code using the server-side python environment. When the local code changes, the server-side code is synchronized in real time.
1. Install pycharm professional version
Note: You need to install the pycharm professional version. The community version lacks remote debugging functionality.
2. Create a new demo project locally
The path where the project is located: D:\Codes\python\local, the main.py code is as follows:
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Running python main.py gets the following output:
3. Configure remote connection
Click Tools->Deployment->Configuration
Click +->SFTP
Name the server. You can name it whatever you want. Here it is named 253.
Click…
Click +
Setting parameters
Click OK
Set server path
That is to say, pycharm will synchronize the local code in D:\Codes\python\local to the server /home1/users/XXX/Codes/fromlocal/ path.
Click Tools->Deployment->Options
Change the option, it means that every time we Ctrl+S save, the code will be synchronized once
4. Upload project code
Right-click the project that needs to be uploaded and upload it to the 253 server created in step 3.
The uploaded file appears under the corresponding path of the server.
5. Configure the python environment
Click File->Settings
Add python environment
6. Configure the running environment of main.py
7. Run and test synchronization
Change the code on the local side:
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
print('test1: change from local')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Run again to achieve synchronization:
8. Call the server terminal to run
Create a new terminal
Enter the project path and run, you can get the same result
Change local main.py
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
print('test1: change from local')
print('test2: change from local')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Ctrl+S save and run again to achieve synchronization.
Therefore, when running in both ways, local changes can be synchronized in real time on the server side.
PyCharm is a widely used Integrated development environment(IDE) for Python programming language. Moreover, Pycharm provides a very useful working environment for Odoo development. On a different note a shortcut is a method of achieving something more quickly or more easily than if you use the usual methods. Furthermore, learning shortcuts in PyCharm will be very helpful to use it efficiently.
In this blog we will discuss some of the useful shortcuts in PyCharm.
PyCharm keyboard shortcuts:
Keyboard shortcuts include hotkeys which helps you stay more productive .Most of its commands are related to editing, navigation, refactoring and other specific tasks. Here are certain PyCharm keyboard shortcuts
1. Double Shift— Search everywhere
By using double shift we can search anything anywhere such as classes, files, Symbols and actions, also we can open it and execute it.
2. Ctrl + E- View recent files
Using Ctrl + E we can view the recent files and also we can filter the files that we made changes to.
3. Ctrl + Shift + N— Can be used to Go to the file Directly
4. Ctrl + /- Used to Comment out a line or block of code
5. Ctrl +Shift + /- Used to Comment out a line or block of code
Both the shortcuts Ctrl + / and Ctrl +Shift + / helps to comment or uncomment a line or a block of code.
6. Ctrl +Shift + F— Used to search in the entire file
This shortcut helps you search a certain file on your project, module or Directory
7. Ctrl + F — Search in a specific file
Suppose if you want to search for data or content in a specific file, you can select the file and open it then enter Ctrl + F to perform your search.
8. Alt +Shift + C— View Recent Changes
If you want to view what are the recent changes done, you can use this shortcut
9. Ctrl + D – Duplicate the selected block or line at caret
By using this shortcut you can duplicate a line or a block of code on your file.
10. Ctrl + G – Navigate to a line with the specified number in the current file
Suppose if you want go to a specific line on your code. Press Ctrl + G and specify the line number then click on ‘OK’ option which will take you to it.
11. Ctrl + Z – Undo the operation done
12. Ctrl + Shift + Z– Redo the operation done.
13. Ctrl + W – Extend your Selection
Suppose you select a line of code but you want to extend the selection. Press Ctrl + W , which will extend your selection
14. Ctrl + A – Select all data or lines.
By using this shortcut you can select entire line of code from your file
15. Ctrl + Shift + J – Join lines of code
Select a line or block of the code from your file, then press Ctrl + Shift + J it will make the lines joined to be in one line
16. Ctrl +N— Jump to a class in the project with specified name.
You can jump to a class in the project having a specified name.
17. Ctrl +S— Save all the files and settings
18. Ctrl +V— Paste from the clipboard
19. Ctrl +R— Call the Replace Text dialogue box
You can select a string or a word then press Ctrl + R. Now you can replace it from where you select or from the entire code
20. Ctrl +Y— Delete a word from caret location to the end of word
As we have understood about the certain PyCharm keyboard shortcuts let’s now move on to understand about the various navigational keys options available.
Navigation Keys:
Navigation keys makes the movement of the pointer around the screen easier by cutting down your mouse usage. Moreover, it helps the programmer be more efficient to do certain tasks on the computer. In addition, knowing navigation shortcuts in PyCharm will be very helpful in using it with efficiency. Hee are certain navigation shortcuts used in PyCharm:
1. Ctrl + Page Down— Move down to the bottom of the page.
It will moves the pointer to bottom of the page
2. Ctrl + Page Up— Move to the top of the page.
It will move the pointer to top of the page
3. Ctrl + Down— Move line at caret down by one line. Preserving syntactical correctness
By using this shortcut you can move down line by line in your code
4. Ctrl + Left— Move to previous word
This shortcut helps you to move to the previous words from the current location on your code
5. Ctrl + Right— Move to next word
This shortcut helps you to move to the next words from the current location on your code
6. Ctrl + Up— Scroll up
By using this shortcut you can move up line by line from your code
7. Ctrl + Home— Move to the beginning of text
Suppose if you want to move to the very beginning of file, you can use this shortcut
8. Ctrl + End— Move to the end of text
Suppose if you want to move to end of you file, you can use this shortcut
9. Ctrl + Enter— Split line or open item
By using this shortcut you can split lines of code from your file. Moreover, it helps you to open an item from the Pycharm
10. Ctrl + Backspace— Delete to word start
This shortcut helps to delete words.
As we are clear on navigation shortcuts used in PyCharm let’s now move on to running or debugging shortcuts available in PyCharm
Running/Debugging:
These Shortcuts help in the process of execution and debugging to run easier. Some useful Running/Debugging Shortcuts in PyCharm are listed below.
1. Shift + F10— Run
To run you program file on Pycharm you can use this shortcut
2. Shift + F9— Debug
To Perform debug operation on your code press Shift + F19.
3. Alt + 5— Activate debug window
If you want see the debug window press Alt + 5
4. Alt + F8— Evaluate arbitrary expression
To evaluate the arbitrary expressions on your code you can use this shortcuts
5. Shift + Alt + F10— Choose and run a configuration file.
By clicking Shift + Alt+ F10 it will list the all existing configuration files. Moreover, you can choose the configuration file you want and run it.
6. F7— Step to the next line executed
Step to the next line to be executed during debugging.
7. F8— Step to the next line in this file
Step to the next line in this file during debugging.
8. F9— Resume program execution
This shortcut helps you to resume the program execution during debugging.
9. Shift + F2— Terminate a debugging session
To end the debugging you can press Shift + F2 .
10. Ctrl + Shift + F8— View and manage breakpoints.
This shortcut helps to view and manage all the breakpoints
As we are clear on certain Running/Debugging Shortcuts in PyCharm let’s now move on to certain tips and shortcuts used to run the PyCharm in the next section.
Tips and Shortcuts:
Here is a list of certain tips and shortcuts used to run the PyCharm:
1. Comparing two files
a). Select your file
b) Then press Ctrl + D
c) Select a file to compare
d) Then you will get the comparison between these two files
2. Ctrl + Alt + O— Optimize imports
You can optimize the imports using Ctrl + Alt + O
3. Shift + F6— Rename variable
Rename the variables using Shift + F6
4. Ctrl + F12— Shows the file structure
Using the Ctrl + F12 the PyCharm will show the file structure.
5. Ctrl + Click— To Shows the declaration
6. Alt + Ctrl + F4— To open image in external editor
7. Ctrl + R— Replace in a file
8. Shift + Tab – To open a Unindent tab
9. Column selection— Drag mouse pointer + Alt + Shift
Column Selection by dragging your mouse pointer while keeping the Alt + Shift key pressed.
10. Debugging
Debugging is a useful tool to solve the errors in your code. The debugging can be done by following the a certain steps which are described below:
a) Click on the left side of your code line. A red dot will appear
b) Click on the debugger icon on the screen, execution will stop on the first red line. By clicking F8 you can execute line by line and skip to the next dot by clicking F9.
11. Your own shortcuts
You can add your own shortcuts by using:
Ctrl + Alt + S? Keymap
There are the certain tips and shortcuts used in the PyCharm operations, hope that this was helpful to you.