Split selection into lines in PHPStorm - phpstorm

In Sublime I was quite fond of the "Split selection into lines" shortcut (super+shift+l). However I cannot find an equivalent of that in PHP Storm 8, I've found a "Split into lines" function in the Edit menu but feeding it either \n or \r doesn't seem to work. Does that function exist in PS ?

By default on PHPStorm 10+, you can toggle the Column Selection Mode with:
CMD + SHIFT + 8
Of course, you can configure any stroke you like. I like to keep the original one and add the one that matches Sublime which is CMD + SHIFT + L. Here is how:

Another option would be to use column selection mode:
https://stackoverflow.com/a/30031481/672989

There is a "Split Selection into Lines" action in the Extra Actions plugin.
Compatible with: Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio

If I have a 200 line selection I don't want to have to create a cursor at the end of every line.
You do not have to "create a cursor at the end of every line" -- just create cursor on the beginning of each line (on Windows it would be Alt+Mouse drag Down/Up) and then just press End button. This is not that straightforward as separate dedicated action .. but still does the same job and pretty easy to execute.
In any case: there is no such exact action currently available in PhpStorm, unfortunately.
Please follow this ticket (star/vote/comment) to get notified on progress: http://youtrack.jetbrains.com/issue/IDEA-122181

Related

PhpStorm navigate to -> file search only for Twig files

I have strange problem connecting with PhpStorm IDE. I use version 2016.3.2 Build #PS-163.10504.2.
I love using Ctrl + Shift + N for searching files which I need to override. I have 2 project (one new, one old) and in old file searching works fine and in new search only for twig files and nothing else.
Is there any configuration I need to change?
Check filter -- the blue Funnel icon on the right top corner of that popup -- you may have selected to list files of certain types only.
Otherwise -- try universal File | Invalidate Caches... and restart IDE -- it usually helps in such "suddenly stop working" situations.

Set syntax for a specific file name in Sublime Text 2/3

I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.
What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.
I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.
Is there any known way to get Sublime Text base a highlighting scheme on the full filename?
Take a look at the ApplySyntax plugin.
The previous answer is completely true; however, I thought it would be better to have it here all in one place rather than going on another webpage to find the list of procedure to apply it
Sublime text 3
This is found here
Ensure Package Control is installed. Instructions are found here.
In Sublime Text, press Ctrl+Shift+P (Win, Linux) or Cmd+Shift+P (macOS) to bring up the quick panel and start typing Package Control: Install Package.
Select the command and it will show a list of installable plugins.
Start typing ApplySyntax; when you see it, select it.
Restart to be sure everything is loaded proper.
Enjoy!

How to start Sublime Text with selected project using a local .sublime-project file?

I may be missing the obvious, but can't seem to solve this fairly simple & typical case (with v3 build 3022 on Debian or XP, in case it matters):
Start Sublime Text opening a project "myprj", specified on its command-line,
using default.sublime-project located under that project's dir (say "/repo/myprj"),
automatically re-opening the last open files of that project (i.e. its workspace),
using default.sublime-workspace for that (also from the same project dir)
but (obviously) not auto-opening any other files remembered from non-project sessions,
and automatically saving all open files (to the above default.sublime-workspace) on exit.
Ideally:
$ sublime_text --project /repo/myprj/default.sublime-project
should just work. But it doesn't (see below).
Another approximation that seemed reasonable:
setting "hot_exit" and "remember_open_files" to false, and then invoking ST with:
$ sublime_text --data /repo/myprj --project default.sublime-project
But ST3 either doesn't find the project file (via --data), unless I chdir there first (--data seems to be no longer supported?), and it either doesn't auto-open any workspace files from last time (despite a previous "Project / Save Workspace As..."), or, if I set "remember_open_files" back to true, it just re-opens the last open files regardless of the project given on the command line.
I guess the issue is the workspace file not being handled automatically for some reason, and I'm just missing some trivial step somewhere. (The official docs (and also the unofficial) seem to discuss command-line switches for OS X only, and asking for --help didn't actually help with this one.)
(Please note: I wouldn't like to launch ST first, and then switch to some project from inside manually, and I also don't want to store the sublime-project/-workspace files outside of the prj. dir.) Thanks a lot!
I seached for a solution for a similar problem these days and didn't find a proper way. So i created an automator app with a small apple script. Maybe this helps you too.
Open Automator and Choose news Application.
Create an action to start Sublime Text 2
Insert an action to perfom the following apple script:
delay 0.2
tell application "System Events"
tell process "Sublime Text 2"
tell menu bar 1
tell menu bar item "Project"
tell menu "Project"
tell menu item "Recent Projects"
tell menu "Recent Projects"
click menu item "~/yourproject.sublime-project"
keystroke "p" using {command down, shift down}
end tell
end tell
end tell
end tell
end tell
end tell
end tell
For anyone still looking to do this, you can launch the built-in command line tool and launch it with a project like so (Mac OSX):
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" --project "absolute-path-to-your.sublime-project"

pressing ctrl+w in mysql workbench results in ETB

So I'm using the MySQL Workbench SQL Editor 5.2.45 CE
However whenever I try to close a tab using the keyboard shortcut Ctrl+W, instead of closing the tab it prints out "ETB" in the query editor instead and does not close the tab...
Any idea what's causing this and how to resolve it?
You are probably working on Windows. The ETB output is from the editor when the hotkey is not handled in the UI and hits the editors input processor without being defined for an action (like select word or copy to clipboard). The editor control is a Scintilla instance which is able to also display non-printable characters.
The hotkey Ctrl+W was previously used to close tabs, but since Ctrl+F4 is much more common on Windows it was changed. So use Ctrl+F4 in the future instead.

Set default syntax to different filetype in Sublime Text 2

How do I set a default filetype for a certain file extension in Sublime Text 2? Specifically I want to have *.cfg files default to having Ini syntax highlighting but I cannot seem to figure out how I could create this custom setting.
In the current version of Sublime Text 2 (Build: 2139), you can set the syntax for all files of a certain file extension using an option in the menu bar. Open a file with the extension you want to set a default for and navigate through the following menus: View -> Syntax -> Open all with current extension as... ->[your syntax choice].
Updated 2012-06-28: Recent builds of Sublime Text 2 (at least since Build 2181) have allowed the syntax to be set by clicking the current syntax type in the lower right corner of the window. This will open the syntax selection menu with the option to Open all with current extension as... at the top of the menu.
Updated 2016-04-19: As of now, this also works for Sublime Text 3.
Go to a Packages/User, create (or edit) a .sublime-settings file named after the Syntax where you want to add the extensions, Ini.sublime-settings in your case, then write there something like this:
{
"extensions":["cfg"]
}
And then restart Sublime Text
In ST2 there's a package you can install called Default FileType which does just that.
More info here.
You can turn on syntax highlighting based on the contents of the file.
For example, my Makefiles regardless of their extension the first line as follows:
#-*-Makefile-*- vim:syntax=make
This is typical practice for other editors such as vim.
However, for this to work you need to modify the
Makefile.tmLanguage file.
Find the file (for Sublime Text 3 in Ubuntu) at:
/opt/sublime_text/Packages/Makefile.sublime-package
Note, that is really a zip file. Copy it, rename with .zip at the end, and extract the Makefile.tmLanguage file from it.
Edit the new Makefile.tmLanguage by adding the "firstLineMatch" key and string after the "fileTypes" section. In the example below, the last two lines are new (should be added by you). The <string> section holds the regular expression, that will enable syntax highlighting for the files that match the first line. This expression recognizes two patterns: "-*-Makefile-*-" and "vim:syntax=make".
...
<key>fileTypes</key>
<array>
<string>GNUmakefile</string>
<string>makefile</string>
<string>Makefile</string>
<string>OCamlMakefile</string>
<string>make</string>
</array>
<key>firstLineMatch</key>
<string>^#\s*-\*-Makefile-\*-|^#.*\s*vim:syntax=make</string>
Place the modified Makefile.tmLanguage in the User settings directory:
~/.config/sublime-text-3/Packages/User/Makefile.tmLanguage
All the files matching the first line rule should turn the syntax highlighting on when opened.
The best solution for me turned out to be to used the ApplySyntax package.
The steps are as follows:
Install the package via Package Control
CTRL + SHIFT + P and enter ApplySyntax: Browse Syntaxes. Find your desired syntax here and note the exact line shown, e.g. I was looking to set it to Markdown from the Markdown Editing package, so for me the line was MarkdownEditing/syntaxes/Markdown.
CTRL + SHIFT + P and enter ApplySyntax: Settings.
On line "new_file_syntax": "XYZ", enter the line from Step 2.
See here for further documentation.
I found this to work better than the DefaultFileType package, because it isn't limited to just new files created by pressing CTRL + N and captured new tabs opened by clicking the empty space to the right of an open tab.
I hope is useful to someone 11 years after the original question was asked. 😅