For example, in CSS files, for font-family one suggestion is Arial, Helvetica, sans-serif. I’d like to add “Helvetica Neue”, Helvetica, sans-serif
Where can I put custom auto-completes?
Bump.
I’ve got a bunch of ‘custom markup’ the new company I work at uses. I would like to add this into some kind of auto-complete so I don’t have to remember it all - I could just CTRL + SPACE and find the correct item, right?
Anyway it links in with the original question: Where do I add custom auto-completes?
For what it sounds like you’re talking about (I am in the same situation) you could create snippets with custom triggers.
For example, I found I had to often enter a private string variable in Action script often, so:
<snippet>
<content><![CDATA[
private var ${1}:${2:String} =
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pvar</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.actionscript</scope>
</snippet>
So, I can type “pvar” and tab.
However, in my post I was specifically referring to auto-completes (the menu that appears on ctrl-space), if there’s only 1 or two adds I want to make.
You can create a “Default.sublime-commands” file either in the “User” packages directory or in any other packages directory.
Check out the command palette documentation for more details.
For some reason I seem to remember that the file has to be named “Default.sublime-commands” rather than “something_else.sublime-commands” or it won’t be recognized, although that might just be my imagination (or possibly an old bug that has since been resolved).
Thanks, but those look like commands that will appear when I invoke the command palette.
I am talking about the popups (see attached)
I have many snippets, which I can invoke with a tab-completion. But this is an existing set of completions, as optional completions for font-family. I just want to add my own font sets to that menu.
To add more options to the ZenCoding autocompletions, you will have to add to Packages/ZenCoding/Scripts/css_metadata.xml
To create completions you just need to create a file something like this:
{
"scope": "source.css",
"completions":
"inherit", "none", // other words..
{ "trigger": "backgroundAttachment", "contents": "background-attachment: ${1:Fixed Scroll}${1/(f$)|(s$)|.*/?1:ixed:?2:croll/i};$0" }
]
}
Save it with the extension ‘.sublime-completions’ and put it in either your User folder or the appropriate language folder. ‘source.css’ tells it to only work with .css files.
Andy.