Home Download Buy Blog Forum Support

Autocomplete css classes etc. in HTML

Autocomplete css classes etc. in HTML

Postby Lazze on Fri Feb 17, 2012 7:33 pm

So, let's say I included a CSS file in my HTML document with the ordinary
Code: Select all
<link rel="stylesheet" href="css/style.css" />
.
I then want my HTML document to autocomplete stuff that I might use from my stylesheet, for example:

In my CSS I might have this:
Code: Select all
.container {
  margin-left: auto;
  margin-right: auto;
  width: 960px;
}


I might then have this in my HTML:
Code: Select all
<div id="content" class="container"></div>


What I want to do, is to autocomplete "container" in my HTML document, because I took that from my stylesheet. I hope you understand what I mean, is this possible?
Lazze
 
Posts: 1
Joined: Fri Feb 17, 2012 7:19 pm

Re: Autocomplete css classes etc. in HTML

Postby Frenzy on Sun Feb 19, 2012 7:07 pm

Use this plugin made by Noah:

http://stackoverflow.com/questions/9081 ... ther-files

you just need that included file opened in tabs ;)
Frenzy
 
Posts: 4
Joined: Sun Feb 19, 2012 1:36 pm

Re: Autocomplete css classes etc. in HTML

Postby handycam on Sun Feb 19, 2012 7:48 pm

How does one use the plugin code from your link? Save it as what/where, for example.
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Autocomplete css classes etc. in HTML

Postby Frenzy on Sun Feb 19, 2012 8:01 pm

in Sublime click on Tools -> New Plugin ... paste that code there and save, restart sublime and it will work ;)
Btw: try install SublimeCodeIntell .. i think it will give you better satisfaction ;)
Frenzy
 
Posts: 4
Joined: Sun Feb 19, 2012 1:36 pm

Re: Autocomplete css classes etc. in HTML

Postby ilya on Sun Feb 19, 2012 8:14 pm

Very cool! Thanks!
ilya
 
Posts: 122
Joined: Fri Sep 11, 2009 8:32 pm

Re: Autocomplete css classes etc. in HTML

Postby handycam on Sun Feb 19, 2012 9:11 pm

I can't get the CodeIntel package to do anything, but this plugin mostly works.

It won't hint CSS class names that have a hypen in them, however; it cuts the name suggestion at the hyphen.

For example, if the css has ".gallery-header", then all that's hinted or completed is "gallery",
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Autocomplete css classes etc. in HTML

Postby c41 on Tue Feb 26, 2013 11:26 pm

I'm still having trouble getting Sublime Text 2 to autocomplete css classnames for me.

Similar to handycam above, I cant quite get autocomplete to work fully. (hypens in classnames seem to sometimes get pulled in sometimes, but not others)

Without any packages installed, I am getting Sublime to autocomplete classes from a linked (open or not) css file, but it wont match all.
(I've also tried other packages "Anyword Completion", "All Autocomplete", "SublimeCodeIntell" with no success)

Here's an example of how Dreamweaver pulls in all, but Sublime doesnt:

Image

(Don't flame me :) Obviously Dreamweaver is not an ideal choice of editor - hence why I'm asking how to get this working in Sublime :)

Does anyone have this working seamlessly? Could you tell me what settings/package you use?

cheers, Pete
c41
 
Posts: 4
Joined: Tue Feb 26, 2013 11:02 pm

Re: Autocomplete css classes etc. in HTML

Postby c41 on Thu Aug 29, 2013 5:05 am

problem solved - see this thread: viewtopic.php?f=3&t=13699&p=53117#p53117
c41
 
Posts: 4
Joined: Tue Feb 26, 2013 11:02 pm

Re: Autocomplete css classes etc. in HTML

Postby izikeo on Tue Jan 07, 2014 2:45 am

Frenzy wrote:in Sublime click on Tools -> New Plugin ... paste that code there and save, restart sublime and it will work ;)
Btw: try install SublimeCodeIntell .. i think it will give you better satisfaction ;)


Good plugin, but +1000000 for suggesting SublimeCodeIntel. Very good plugin.
izikeo
 
Posts: 1
Joined: Tue Jan 07, 2014 2:44 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests