In most editors it's possible to perform a search within the open folder/project. How can this be achieved with Code in Juno, if at all possible?
2 Answers
I don't think the feature exists in Code yet. However, a simple workaround is:
- Right-click the folder / project, select "Open in" > "Terminal"
- Type in the command:
grep -Ril "text to search for" .
That will list all the files containing that text. Some notes:
.
Means search from the current folder-R
Searches recursively, not just files in the current folder-i
Searches case-insensitively-l
Prints just the file names, not showing the line of text it's in
Update: If you want to then open the files in Code, add `pwd`
to the end, which will print out the full paths of the files. Then use the names like io.elementary.code filename
to open it in Code.
If you need to find files with a particular name, you can use the same method to open the folder in Terminal, then run the following command:
find . -name '*part of name*' -print
If "part of name" is for example "list", that will match files named "todo list.txt". You can also use the following flags:
-type d
To search for only directories (folders)-type f
To search for only files
-
Thanks Dane, but I moved away from elementary OS. There were so many issues with Juno, it was relly disruptive for my workflow. In the meantime I switched back to Pop!_OS, and smooth sailing ever since.– woutNov 27, 2018 at 14:22