Execute search/replace in PhpStorm as action - phpstorm

I'm looking for a solution to:
store favorite "Find Occurrences of ..." and
execute them without any more questions by the UI in one stroke
I know the option ALT + 3 -> STRG + E to open the last Find Usages, but that are only "Find" and not "Replace in Path" actions
Maybe I need to develop a plugin - that could look like this:
DO REPLACEMENTS:
----------------------------------
[X] foo -> bar
[ ] bar -> foo
[X] ): boolean -> ): bool
----------------------------------
[add] [execute] [execute & review]
----------------------------------
but any other ideas are welcome!
Important is to use PhpStorm`s file scopes! Because I would like to use my own custom scope.

You can use "Structural Search Inspection". It's base on the "Structural Search and Replace" engine which is pretty powerful. Once configured you can run the inspection using the "Run Inspection by Name..." action with a custom scope. It has a quick fix which can be used to replace occurrences.

Related

ROT47 of the current selection in SublimeText

When doing CTRL+SHIFT+P, there is command named Rot13 selection which allows to encrpyt the selected text.
I'd like to add a command named Rot47 selection that does:
selection = 'Test'
print ''.join(chr(33 + ((ord(ch) + 14) % 94)) for ch in selection)
#Output: %6DE
Where to write this Python code in SublimeText to have this new command present in CTRL+SHIFT+P?
You can write a plugin.
Some beginner (and not 100% correct) code is available here.
A complete plugin for Rot47 would have the following code:
import sublime, sublime_plugin
class Rot47Command(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if not region.empty():
s = self.view.substr(region)
s = ''.join(chr(33 + ((ord(ch) + 14) % 94)) for ch in s)
self.view.replace(edit, region, s)
Where to write this code?
Tools > New Plugin... will open a new buffer with some boilerplate code. Replace the boilerplate with the above code and save the file as rot47.py in /<sublime-text-dir>/Packages/User/.
You can test the above plugin by opening the console using Ctrl+`, and typing view.run_command('rot47') and hitting Enter. Make sure that you've selected some text before running your new Rot47 command.
Furthermore, if you want to create a keyboard shortcut for your new rot47 command: go to Preferences > Key Bindings -- User and add the following entry:
{ "keys": ["ctrl+shift+4"], "command": "rot47" }
(you can of course choose a more meaningful key combination.)
What did the above plugin code do?
self.view.sel() gives an iterable on the selected text regions (there can be multiple selections in the same buffer, go Sublime!). A region is basically a (start_index, end_index) pair that denotes a selected substring. self.view.substr(region) gives you the required substring.
We then modify the selection text (variable s) as desired and replace the selection with the new text (the call to self.view.replace()).
For a more extensive API reference, see this.

How to get PHP manual references automatically in PHPStorm 8?

I'm a newbie and there is so much to learn. I would like to see PHP Manual reference if I type a function. Something like this:
strlen()
int strlen ( string $string )
Returns the length of the given string.
example:
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
That would be nice to see somewhere in the IDE. "Show quick doc on mouse move" in version 8 is not available anymore under Edit menu. Ideally I would like to set phpStorm so that I can
1) see a pinned window somewhere that
2) updates automatically as I type new functions with appropriate 3) PHP Documentation reference
Two possible (different) ways:
Enable Settings (Preferences on Mac) | Editor | General | Show quick documentation on mouse move
View | Quick Documentation -- you can pin it (so it's stays permanently on a screen) and enable auto-updating of docs for element under caret (available once it became pinned; a button next to "X" called Auto-update from source).

How can I find keywords in sublime text

I'm user of sublime text.
I want to get the file name which include specific keyword.
I always find file name using grep command.
ex)
$ find . -type f -print | xargs grep "apple" /dev//null | cut -d: -f1 | sort -i | uniq
I want to do same operation in sublime text.
How can I do same operation in sublime text ?
You can press ctrl + shift + f and search a keyword in your project folder. It will show you the files containing the keyword
Check http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace_files.html
for details
Sublime has a great feature called 'goto anything', which allows you to search both files and file contents within your project.
If you press CTRL+P (windows; Mac I believe uses shortcut CMD+P) a search panel will open, and you may type the keyword contained in the filename, which will return a list of files containing your keyword. In my experience and understanding, filename matches are returned with a higher priority than matches for file contents.
Use your keyboards arrow keys to highlight a result in the list. Pressing enter will select/open that result.
SublimeText.com has a brief overview of the Goto Anything feature on the homepage, and more information is available on the official documentation.

Vimscript print function?

Is there a function in Vimscript or a convention that allows you to simply print text to the editor? The function echo only supplies a command line print function, and does not actually print to the editor.
When you say "print to the editor", I take it you mean "print to the current buffer". If that's correct, take a look at :help append().
A facility I sometimes use is :redir #" (or :redir #a for register a), which redirects the output of commands to a buffer, so you can paste it. To stop output redirection, say :redir end. See :help :redir.

Set up "toggle comment" command in slickedit? Add more than one hotkey to a command in slickedit?

Is there a way to do either of these two things?
Add hotkey to "toggle comment". By
default slickedit seems to have 2
separate commands, comment and
erase-comment. I wish to have a single
hotkey to handle both (similar to how
eclipse/netbeans handles it).
█
Add 2 separate hotkeys to do the same
command.
In SE16 (probably also in previous versions, I didn't check) you'll find a command toggle-comment (look in source file box.e). You may bind that to a key.
And the second one is simple: Go to Tools -> Options, select category "Keyboard and Mouse", sub "Key Bindings". Search the command/key you need, and press the button "Add..." to add another key binding.