What is the "overlay" in ST and how can it be used? (please indicate default key bindings)
It's just a generic interface element which pops up a list of options and a field for searching them. Examples of overlays include the command palette (Ctrl+Shift+P) and Goto Anything (Ctrl+P).
Do you talking about command which by default binded to "ctrl+;"?
As far as i know it works like find(ctrl+f), but overlay can search for one word only.
For example we have this file:
Someone correct my english pls
If we will use find command we could look for more than one word like "my english".
But if we gonna use overlay we could to search for "my" or "english" only.
We can't search with overlay for "my engligh" cuz here is more than one word.
Sublime Text can read settings from multiple configuration files.
The default order is described here.
Packages/Default/Preferences.sublime-settings
Packages/Default/Preferences (<platform>).sublime-settings
Packages/User/Preferences.sublime-settings
<Project Settings>
Packages/<syntax>/<syntax>.sublime-settings
Packages/User/<syntax>.sublime-settings
<Buffer Specific Settings>
The latter configuration files override ("overlay") the former, allowing you to have more specific settings for certain programming language, project, etc.
Related
I've created a bunch of snippets in Sublime Text 2, but I cant remember them all off the top of my head. I've seen in a number of tutorials that as people start typing their snippets tab-triggers it will start to provide a list of the matching snippets. I don't see this.
Is there a setting somewhere for this? Or do I need to create a special file (completions file?). For most snippets I have the <scope> commented out as I may use in a PHP or HTML file for example depending what I am working on.
Most of my snippets tab triggers start the same elq- prefix, so it would be very helpful if it were to start showing me the options as I type.
The setting auto_complete_selector controls when Sublime automatically offers the popup for possible completions. The default value for this setting is:
// Controls what scopes auto complete will be triggered in
"auto_complete_selector": "source - comment",
This means that it will automatically pop up for any file that's considered a source code file, except within a comment.
The scopes for the file types that you mention in your question are text scopes and not source scopes, which stops the popup from appearing.
One way around that would be to manually invoke the auto complete panel by using the appropriate key binding, which by default is Alt+/ on Linux or Ctrl+Space on Windows/OSX. When you do that, the popup for possible completions at this point is manually displayed.
To allow this to work more automatically, you would need to modify the setting for auto_complete_selector to be more appropriate for your situation.
To do that you could select Preferences > Settings - User from the menu and add or modify the auto_complete_selector setting as follows:
"auto_complete_selector": "source - comment, text.html",
This says that the selector should always be displayed in source files except inside comments (like the default) and also within HTML files.
You could also use text instead of text.html if you want it to work in all text files of all types, although this would possibly get quite annoying while working with plain text files. Substitute an appropriate scope or set of scopes here as appropriate to dial in the places you want this to be automatically offered.
The default SublimeText 2 snippets, located in the Packages directory and then under, say, Ruby are useful but only if you happen to know the tab trigger. For example the file ~/Library/Application Support/Sublime Text 2/Packages/Ruby/alias_method-..-(am).sublime-snippet contains:
<snippet>
<content><![CDATA[alias_method :${1:new_name}, :${0:old_name}]]></content>
<tabTrigger>am</tabTrigger>
<scope>source.ruby</scope>
<description>alias_method ..</description>
</snippet>
So we can access this trigger by hitting am then tab.
My question is, if this snippet chucks in alias_method :${1:new_name}, :${0:old_name} isn't there a way that I can use this snippet without knowing its am trigger, just by starting to type alias_m... for example?
Umm, no, not that I can find. I just opened up a blank Ruby file, hit a, and autocomplete popped up with all sorts of options, including the snippet you mentioned. However, if I then typed an l (starting to spell out alias...), the option for the am snippet disappeared. So, it looks like autocomplete is not searching the <description> field, only the <tabTrigger> field. There aren't any options in Preferences -> Settings - Default that would seem to address this situation.
So, unfortunately it would seem the solution is one of two things - either edit all your commonly-used snippets to have tabTriggers that make more sense to you, or put together a snippet cheat sheet. It looks like at least one other person was thinking the same thing, as I found this collection without too much searching.
Good luck!
I'm using PHPstorm 6.
When i try to format my code which contains french characters, i got a issue like you see on the pictures.
NB : i got this just when i put my text into a tag like :
<span>génie Informatique</span>
So before formatting i was this :
And after formatting i got this
Thanks
What kind of file is that -- HTML?
In any case: you do have light green background between the tags. This suggests that you have another language injected between those tags (Language Injection functionality), which may use completely different formatting rules (not HTML -- e.g. JavaScript or whatever you may have injected there).
Possible solution:
Place cursor somewhere between such tags, Alt+Enter (or click on light bulb icon) and use "Uninject Language" option.
Alternatively: Settings | Language Injections -- find and disable (or even delete) offending entry there (will be "global" or "project" type in last column).
I am a big fan of ST2, and have been finding oodles of tricks to code/type faster.
One thing that I would like to know is if it is possible to create custom symbols for things like code blocks, include segments, and other bookmarks for goodies in your file.
For example:
I want to quickly include a standard C lib via (inc, tab). Is there a way for me to create a section where I keep all my standard lib includes (i.e: #CSTDLIB) and use the functionality of goto-> symbol (ctrl+r) to skip straight to this segment from anywhere in my file?
I tried looking to see if there was some sort of special handler to place in a comment that would recognise it as a "bookmark" but couldnt really find anything.
Cheers in advance.
This is an old question, so I'm answering for the latest ST3. Pretty sure this was possible with older versions as well.
The builtin C/C++ syntax definitions support a special formatting for comments in the following form:
// =jump target=
The string "jump target" will then be listed in the symbol list for ctrl+r. Unfortunately that only works if the // is at the beginning of the line. But we can fix that.
Install PackageResourceViewer, then from the command palette use PackageResourceViewer: Open Resource->C++->C.sublime-syntax.
In this file it says:
- match: ^// =(\s*.*?)\s*=\s*$\n?
scope: comment.line.banner.c
captures:
1: meta.toc-list.banner.line.c
Now remove the ^ in front of the regexp, save the file. Now you can enter comments // =jump target= anywhere, and jump there with ctrl+r.
If I have understood you correctly, you can use Ctrl + F2 shortcut for making bookmarks anywhere in your file, and walk through these bookmarks by F2 button. To remove bookmark, press Ctrl + F2 again in the line which you want to exclude from bookmarks.
If it isn't so, and this functionality doesn't cover your requirements, please specify more detailed use case.
Hope it will be useful to you
With the help from fraxel on this question: Assigning multiple snippets to a single key binding I was able to create a handy popup menu to organize all my snippets in the way Textmate works.
Is it possible to tell ST2 what order I want them to appear in in the overlay command palette? Right now they are seemingly random and I'd love to be able to set some order to them.
I can't tell how ST2 orders them.
More:
All of my snippets have file names that indicate their language:
e.g.
PHP_mySQLLoop.sublime-snippet
PHP_mySQLi.sublime-snippet
HTML_basePage.sublime-snippet
jQuery_ajax.sublime-snippet
The <description> I use is also standard:
JMR PHP, mySQL Loop
JMR PHP, mySQLi
JMR HTML, Base page
JMR jQuery, $ajax
Changing PHP_mySQLi.sublime-snippet to PHP_1_mySQLi.sublime-snippet or 1_PHP_mySQLi.sublime-snippet had no effect nor did changing it's description.
I do not have the <scope> set for any snippet at his point...maybe I should...?
(This is on OS X, not sure if that has anything to do with this...)