Search and replace in a lot of files - sublimetext2

I'm trying to search and replace a string in a lot of files, this is what I'm currently doing :
CTRL + SHIFT + F
then type my string and finally : replace.
The problem is that Sublime Text OPEN every file, replace my string and I have to save them all then close them.
I need Sublime to only replace the string, is there a settings or something ?

This is currently not possible in Sublime Text, you could use Notepad++ just for this feature or do the following:
You could just open a new window (File -> New Window), do the find and replace and then File -> Save All, close the window and go on where you left off.

Related

Pyautogui: Can I insert text at the current cursor position using a keyboard shortcut?

In Pop!_os 21.10 I created a keyboard shortcut in the settings panel 'ctrl'-'/' to run python3 /home/dg/scuts/p2-pyautogui.py
In /home/dg/scuts/p2-pyautogui.py I used the following:
import pyautogui, time
time.sleep(0.3)
pyautogui.write("el0 n 123. 12345", interval=0.005)
In gedit, I try to run this.
If I press 'ctrl'-'/' and quickly release the ctrl key it works.
If I hold down the control key too long after pressing /, it seems to execute 'ctrl'-'n' and open a new gedit window. Sometimes I get the emoticon input window, which I think is 'ctrl'-'.'
I want to make it more mistake-proof for entering text like date-time for example using a hotkey combination.
What am I doing wrong?

Search within files in search result in Sublime

I often use Sublime Text 2's search all open files/folders feature (CMD+SHIFT+F).
Is it possible to perform a second search that only queries files which contain the first search query?
For example: Search 1 finds 5 files that contain "hello". Search 2 should only query those same 5 files for "world", so the resulting matches will be files which contain both "hello" and "world".
I can search the text which is visible in the results buffer (such as in the screenshot below), but I'd like to search the entire contents of all files that are shown in the results buffer.
1:
Open the find_in_files panel with Ctrl + Shift + F.
In the example, <open folders> is used for the Where: argument, but you can use whatever fits your initial search criteria.
2:
Open the find panel with Ctrl + F while you are still in the results buffer.
Enter ^(/Users/.*)(?=:$) as your Find: argument, and make sure the RegEx switch is enabled. This RegEx pattern will match all of the paths within the results.
( Windows users can enter ^(C:\\.*)(?=:$) )
Copy the selected paths.
3:
Paste the copied paths into a blank document.
Open the replace panel with Ctrl + H.
Enter ^(/Users/.*)(\n) as the Find What: argument, and $1$2,  as the Replace With: argument. This will effectively convert all of the lines into a single line of comma separated values.
( Windows users can enter ^(C:\\.*)(\n) )
Copy the resulting line.
4:
Open the find_in_files panel with Ctrl + Shift + F.
Paste the copied path list as your Where: argument, and enter your second query as the Find: argument.
5:
Repeat as necessary.

Sublime search specfic keywords as function withn the same file

In my project file extension is .ttcn and all the function in that file start with testcase name_of_the_function.
Is there any Sublime plugin exist that can list all the function that is start with keyword testcase followed by test case name?
FYI, most of the common programming languages sublime list all the functions name with shortcut ctrl'r. Thanks in advance for any suggestion or recommendation !
You can use the Find in Files functionality (Find -> Find in Files...). In the Find: field, make sure the first button (Regex) is selected, as well as the last two (Context and Use Buffer), then enter ^testcase. Add the directory you'd like to search in the Where: field, and make sure the Replace: field is empty. Hit the Find button, and a new tab will open showing all lines that begin with testcase.

Justify columns in tab delimited file using Advanced CSV

I have a tab delimited file open in Sublime Text 3 and would like to justify the columns. I have Advanced CSV installed and can specify the delimiter value, but neither a physical tab, nor a "\t" seem to be providing me the output I desire, which is to say that I'm not able to justify the columns correctly after setting this delimiter.
How can I justify a tab delimited file using Advanced CSV in Sublime Text?
In most cases you can actually just use a tab to set the file's delimiter character to a tab. As that is a sort of confusing sentence, here's an expansion on how to set your file's delimiter to a tab.
Open your Sublime options with Cmd+Shift+P
Find the "CSV: Set delimiter" option and select it
At the bottom of your Sublime program you will find the area where it would like you to your delimiting character
Hit the tab button on your keyboard
Hit enter to approve this new delimiting character

How to search multiple files of specific file type within Sublime Text 3

I would like to search for a string within all *.php files in a certain directory (and its sub-directories) using the Shift + Ctrl + F search dialog.
My guess was to set the search location to:
c:\example\*.php
but that gives an error:
Unable to open c:\example\*.php
Is there a way to perform the search I'm hoping to perform?
C:\example,*.php
In the Where: click ..., select Add Folder, after that select Add Include Filter