PhpStorm Find all Instances in current remote file - phpstorm

I am trying to get a list of search results for a string in the current file which is opened from a remote host. CTRL F only highlights the instances in the doc but does not give me an easy overview. If I have a file downloaded to my project folder I can press CTRL SHIFT F for "find in path" and then CTRL ENTER to open the find window. complicated but better than nothing.
Is there a simple "find all in current file" command, disregarding whether its a project file or a remote file?

Click on All button on Find toolbar and it will list all found entries in a standard "Find Results" toolwindow.

Related

How to increase the number of concurrent downloads initiated by an extension?

I have an extension which initiates downloads in its background page. The current problem is when you call chrome.downloads.download for, say 100 times, it will download 5 files at a time until all 100 files have been downloaded.
I had same problem with images and I found some answer which works for me:
Press "Windows-R" to open the Run tool. Type "regedit" into the box, click "OK" and then, if prompted, confirm the operation or type your administrator password to open the Registry Editor.
Double-click the "HKEY_CURRENT_USER" directory in the left pane. Double-click the "Software" sub-directory, double-click "Microsoft," double-click "Windows," double-click "CurrentVersion" and then single-click "Internet Settings."
Open the "Edit" menu, move your mouse cursor over "New" and then click "DWORD (32-bit) Value" to create a new registry entry. Name the entry "MaxConnectionsPerServer" (omit the quotes) and double-click it to view its properties.
Select the "Decimal" option from the "Base" section of the "Edit DWORD (32-bit) Value" dialog that opens up. Type the number of simultaneous downloads you want into the "Value Data" box, such as "10" (again, omit the quotes) and click "OK."
Repeat the previous two steps with only one change: This time name the new registry entry "MaxConnectionsPer1_0Server". Close the Registry Editor, close any open programs and restart your computer. The simultaneous download limit change will now go into effect.
For effect I added 650 connections or downloads and it worked for me downloaded 650 pictures from some html file with this code:
var a = document.getElementsByTagName('a');
for(var i=0; i<a.length; i++){
var myimg = a[i].getElementsByTagName('img')[0].src;
a[i].href = myimg;
a[i].download = myimg;
a[i].click();
}
HERE IS THE ANSWER... I almost gave up then I stumbled upon it. Settings >> Advanced >> Downloads >> Unclick "ask where to save each file before downloading". Done! Now you can have virtually unlimited concurrent downloads (given your also using a download manager addon or other). This was on a Mac - no idea how it is handled on Windows.
Unfortunately you can't control that. It's a limitation of chrome's browser. It would be a security issue if you can flood the user's browser with an unlimited number of downloads.

Go to file when file already open in other panes/windows open in Sublime 2

If I have several panes (groups) open and do CTRL+P (go to anything) and type the name of a file which is already open in another pane, Sublime will open this file in the pane I started Go to anything from. I want it to go to any of the other panes, where this file is already opened instead of opening a new instance of the file.
How can I achieve this?
There are a couple of packages/plugins that may be close to what you want:
GotoOpenFile, you can choose from a list of views in whole window or the active group:
https://sublime.wbond.net/packages/GotoOpenFile
or the newer Zen Tabs, which has some other useful file status as well as tab management
https://sublime.wbond.net/packages/Zen%20Tabs

How to edit multiple files through "Find results" in Sublime Text

When I search multiple files via Command + Shift + F, the result is returned as something like a text file. This text file is editable, but changes made don't affect the original files.
Is it possible to do such that changes in "Find Results" propagates to the original source file?
The Find Results Apply Changes plugin was created to do just that.
You can install it through Package Control's "Install Package" option.
Before using this plugin, make sure that you have UTF-8 encoding enabled using the menu:
File > Save with Encoding > UTF-8
Once installed, you can apply any change you made to a "Find Results" buffer back to the files:
Search for "foo" in a folder (Sublime's default shortcut is CTRL+SHIFT+S)
This will open a "Find Results" buffer listing all the files with "foo" in it.
Change the instances of "foo" for "bar" or something else...
Go to the menu:
Find > Find Results - Apply Changes
This will write all the changes made back to the files and save the modified files automatically.
By default, using menus is the only way to make it work. However, it is quite tiresome and doesn't save as much time as it does with a keyboard shortcut. You can set your chosen keyboard shortcut by adding a new line in
Preferences > Key Bindings - User
by adding:
{ "keys": ["ctrl+r"], "command": "find_results_apply_changes" },
Don't use CTRL+S as it will overwrite saving file shortcut.
Warning!: According to the author of the plugin:
Uses regions to allow you do multiline changes, but when inserting new
newlines, will corrupt files if you commit more than once, this
because the new newlines will shift the line numbers. Will also
'corrupt' files if you add/remove newlines in other instances of the
modified files. eg in another tab. To prevent corruption this packages
will alert you and prevent most of these.
(This is a modified version of the description from the Find Results Apply Changes Github page.)
The shortest workaround I can think of would be to open the target file from search results by simply double clicking the path and then jumping to the according line using Ctrl+G on Windows or ⌃+G on Mac OS.
That's the way I do it and must say it is only a matter of seconds, even without the plugin.

How to open and save files

Is there a way to quickly open files in sublime text2?
At the moment I open files like this.
I open my terminal and enter
subl source/myproj/myfile.rs
Can I do this inside of sublime text2/3?
Also when I want to create a new file in source/myproj/ I usally press ctrl + n to create a new window and then I hit ctrl + s to save and name the file. The problem is when I hit ctrl + s my file system dialog opens and I have to use my mouse.
I think I saw someone using vim and he just could say source/myproj/mynewfile.rs and then the file would be created.
Is this possible in sublime text 2/3?
To quickly open a file in your current project, you can hit Ctrl+P and start writing the filename. This will sort through the files in your project and give you a little list, most likely the one you are looking for is pre selected, but if not, it is somewhere near the topmost options to select from, use arrow key down and highlight it, press enter and you just opened that file.
Another option to quickly create a file is using the AdvancedNewFile plugin.
When you hit Ctrl+n, it asks near the bottom of the window for a path and filename, once you enter it, it opens the new tab with the file already created, not an untitled file to later use system dialog to save to disk.

start opened file from sublimetext in associated program

i usually edit files in sublime text 2 that can also be edited and compiled with another program. As i have them already opened in sublimetext i do the following:
right click and choose "copy file path" (to clipboard)
Win+R to open windows run dialog
CTRL+V to paste the file path
hit enter to open the file with the associated program
i wonder some shortcut can be configured so it automatically starts the opened file with its associate program
thanks in advance
This can be done. I was in a very similar situation using Sublime as my editor of choice over the default SAS program editor. I was able to use the win32com.client.dynamic.Dispatch module to connect to SAS via OLE and pass text from Sublime directly to SAS using Sublime's build system to call my plugin. Making the connection was the easy part, it was the other processing that I had to do which was the time consuming part, but since you want to pass just a file name or the entire contents of your file, this should be a fairly straightforward plugin. Since I do not know what program you wish to open, here is the code that makes my implementation work. Maybe you caan glean something out of this.
def send_to_sas_via_ole(selected_code):
from win32com.client.dynamic import Dispatch
sasinstance = Dispatch("SAS.Application")
# submit the lines to sas
for selection in selected_code:
# for some reason cannot send as one big line to SAS, so split into
# multipe lines and send line by line
for line in selection.splitlines():
sasinstance.Submit(line)
and then the call in the run method of my plugin class:
class RunSasMakoCommand(sublime_plugin.TextCommand):
def run(self, edit):
try:
send_to_sas_via_ole(selected_code)
except Exception as e:
print "\n".join(selected_code)
print "Couldn't connect to SAS OLE"
print e
Good luck!
Open 'regedit.exe';
Navigate to
HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
correct the path. Exit 'regedit.exe'
(optional) restart 'explorer.exe' or reboot your PC.
enjoy :p;
Right click on the file, press "Properties". You will see Opens with SomeProgram and then a change button. Click on the change button, and then look through the list for Sublime Text, if you can't find it, you can choose an application using the file explorer, from there you can navigate to C:\Program Files\Sublime Text 2 and choose sublime_text.exe