Home Download Buy Blog Forum Support

auto [ctrl+space]

auto [ctrl+space]

Postby Bagarn on Sat Nov 02, 2013 8:19 pm


I'm new to sublime and i think it's an awesome editor.
And now I'm woundering, is there any way to autocomplete all the time? For example html attributes? when i type < it shows me some options but when I'm done with my first code snippet <div its blank and leave me there, hanging.. Untill I press ctrl+space (ex <div c) then It will shot me class etc.. What I want is to get the attribute options when i type the "c" for class. I don't want to press ctrl+space all the time :(. Is there any fix for this?

And also.. Auto-close? Is there any fix for this? When I made my <div> its not automaticly closed (</div>) I don't even get a heads up that there is an open div.. :(

Posts: 1
Joined: Sat Nov 02, 2013 8:15 pm

Re: auto [ctrl+space]

Postby quodlibet on Tue Nov 12, 2013 1:17 pm

Kinda. Have a look at the `auto_complete` setting in Preferences > Settings - Default. Copy what you want to change to your User settings and edit it there.

The basic problem you're having is that they syntax for HTML files is "text" rather than "source", where autocomplete is constantly triggered. You can change this behavior by adding something like:

Code: Select all
"auto_complete_selector": "text.html - text.html.markdown, source - comment, meta.tag - punctuation.definition.tag.begin",

This adds the HTML scope to trigger auto complete (but not for Markdown).

To auto close tags you want to set:
Code: Select all
"auto_close_tags": true,

To detect open tags I use the Tag plugin's Lint feature. (There are probably other alternatives.)

Please note that: autocompletion behavior may be different depending on the plugins you've installed and also that I did not test the above -- but it should work :)

Hope some of this helps,
Posts: 576
Joined: Sat Jun 18, 2011 5:53 pm

Return to Technical Support

Who is online

Users browsing this forum: GrrratefuLion, Yahoo [Bot] and 25 guests