Sublime Forum

Auto [ctrl+space]

#1

Hello!

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 :frowning:. Is there any fix for this?

edit.
And also… Auto-close? Is there any fix for this? When I made my

its not automaticly closed (
) I don’t even get a heads up that there is an open div… :frowning:

/Bagarn.

0 Likes

#2

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:

"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:

"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 :smile:

Hope some of this helps,
Alex

0 Likes