Home Download Buy Blog Forum Support

Where can I put custom auto-completes?

Where can I put custom auto-completes?

Postby handycam on Tue Jan 17, 2012 6:21 pm

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
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Where can I put custom auto-completes?

Postby jamy_za on Thu Jan 19, 2012 6:12 am

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?
jamy_za
 
Posts: 22
Joined: Mon Jul 04, 2011 1:11 pm

Re: Where can I put custom auto-completes?

Postby handycam on Thu Jan 19, 2012 11:41 am

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:
Code: Select all
<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.
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Where can I put custom auto-completes?

Postby jbjornson on Thu Jan 19, 2012 12:29 pm

handycam wrote: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).
jbjornson
 
Posts: 343
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Where can I put custom auto-completes?

Postby handycam on Thu Jan 19, 2012 1:20 pm

Thanks, but those look like commands that will appear when I invoke the command palette.

I am talking about the popups (see attached)
Attachments
Screen Shot 2012-01-19 at 8.24.14 AM.jpg
Auto complete
Screen Shot 2012-01-19 at 8.24.14 AM.jpg (39.79 KiB) Viewed 1455 times
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Where can I put custom auto-completes?

Postby jbjornson on Thu Jan 19, 2012 4:47 pm

Hmmm...not sure, but maybe it can be done by adding a sublime-snippet?
jbjornson
 
Posts: 343
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Where can I put custom auto-completes?

Postby handycam on Thu Jan 19, 2012 6:01 pm

jbjornson wrote:Hmmm...not sure, but maybe it can be done by adding a sublime-snippet?


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.
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Where can I put custom auto-completes?

Postby S0und on Wed Feb 08, 2012 8:49 pm

bump?!
S0und
 
Posts: 70
Joined: Wed Oct 28, 2009 4:12 pm

Re: Where can I put custom auto-completes?

Postby C0D312 on Wed Feb 08, 2012 9:14 pm

To add more options to the ZenCoding autocompletions, you will have to add to Packages/ZenCoding/Scripts/css_metadata.xml
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Where can I put custom auto-completes?

Postby agibsonsw on Thu Feb 09, 2012 1:32 pm

To create completions you just need to create a file something like this:

Code: Select all
{
    "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.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 19 guests