ChatGPT解决这个技术问题 Extra ChatGPT

How do I find a word in all my files in Pycharm

I'm new to PyCharm (and Python) but can't find a way to do a complete search for a word in all my files in my PyCharm project. Every time I do Edit-->Find it keeps searching either in the current file of searches for the word where my caret is located. How does one do a complete scan of all files for a word that I typed?

When I select Find Usages, it tells me to position my caret to a specific word.


S
Serafim Costa

On the main menu, choose Edit | Find | Find in Path, or press:

Windows or Linux: Ctrl + Shift + F Mac: ⇧ + ⌘ + F

More info here


My search (Find in Path) stopped working but clicking "File" > "Invalidate Caches/Restart" fixed it. Just commenting here for anyone else having the same problem.
M
Mike Zhao

Actually, you should try double shift, it's search everywhere.


This should work according to documentation, but it does not find words in all the files in a project. Ctrl+Shift+F does.
... wrong answer. Only searches for particular contexts, not for text in general. "Find in Path" is the answer to the OP's question.
C
Chris

If you look at the "project files" tool window, you can right click a directory and choose "find in path".


l
lmiguelvargasf

There are multiple ways to do this. I am using PyCharm 2019.1, but I bet that it will work in previous versions.

Find in path shortcut:

⇧ + ⌘ + F (mac) or

Ctrl + ⇧ + F (windows or linux)

This will open the following in which you can type the word you are looking for.

https://i.stack.imgur.com/cy2hd.png

Find action shortcut

⇧ + ⌘ + A (mac) or

Ctrl + ⇧ + A (windows or linux)

The following will be opened in which you could type Find, and select the option Find in Path (notice that the command for this action is displayed next to it). After selecting this, you will be taken to the same menu that is opened when running the Find in path shortcut.

https://i.stack.imgur.com/Xk2Q1.png

Right click on your project's directory, and choosing Find in Path...

You can right-click on your project's name, and select the option Find in Path... which will also open the menu that is opened after running the Find in Path shortcut.

https://i.stack.imgur.com/DNtZE.jpg


C
Chukwuemeka Inya

Ctrl + Shift + F as others have stated. In addition, toggle those four buttons below the search bar to vary the scope of your search... In Project Module Directory Scope. You really have to watch out. Also, take note of the check boxes above. You want everything to be properly set. You don't want to be searching a Directory when your intention is to search the whole project.