Skip to content

victorteokw/ac-html

Repository files navigation

ac-html melpa badge melpa stable badge

Notice

This project is not maintained anymore. If you like it, fork it. Or consider using alternatives.

Thanks!

Description

Emacs auto complete source for html, slim, haml, and jade.

Watch Screencast.

Upgrade Guide

About Version 0.4.alpha

Version 0.4 is a big advance, the code are refactored to improve extensibility and flexibility.

In the future, per framework completion data is easy to integrate into the big completion engine.

Since it's a big advance forward, it causes compatibility issue.

See configuration for how to setup.

Data Provider

ac-html now has data provider mechanism. You can define your own data provider, and hook the data into ac-html engine.

A data provider can provide data for html tag, attribute, attribute value, id and class.

Language (Adaptor)

An adaptor is hooked into a specific language mode, a adaptor need to provide how to find current tag and attribute, when to trigger tag or attribute completion.

Current available adators are ac-source-html, ac-source-jade, ac-source-haml, ac-source-slim.

Configuration

This example setup completion for haml, same way should work for slim, html, jade, too.

(defun setup-ac-for-haml ()
  ;; Require ac-haml since we are setup haml auto completion
  (require 'ac-haml)
  ;; Require default data provider if you want to use
  (require 'ac-html-default-data-provider)
  ;; Enable data providers,
  ;; currently only default data provider available
  (ac-html-enable-data-provider 'ac-html-default-data-provider)
  ;; Let ac-haml do some setup
  (ac-haml-setup)
  ;; Set your ac-source
  (setq ac-sources '(ac-source-haml-tag
                     ac-source-haml-attr
                     ac-source-haml-attrv))
  ;; Enable auto complete mode
  (auto-complete-mode))

(add-hook 'haml-mode-hook 'setup-ac-for-haml)

For web mode you need additional

(add-to-list 'web-mode-ac-sources-alist
             '("html" . (ac-source-html-tag
                         ac-source-html-attr
                         ac-source-html-attrv)))

Related projects

You may be interested in next projects:

Issues

There are some bugs.

If you find, please report or fix it via issues.

Contributors

This package is originally authored and maintained by Zhang Kai Yu.

The biggest contributors are:

  • Olexandr Sydorchuk

Many thanks to you.