Git Product home page Git Product logo

jade-mode's Introduction

sws-mode

major mode for jade-mode and stylus-mode

__S__ignificant __W__hitespace __M__ode. Because Jade and Stylus are both 'significant white space' languages, sws-mode can be used to edit both types of files

Lines can be indented or un-indented (is that a word?) with tab, shift-tab respectively. Indentation will look at the proceeding line and not indent more than 1 level of nesting below it.

html
  body
    #container
    .content
  ^
  |----cursor anywhere on this line except at beginning of text, press tab or S-tab

html
  body
    #container
    .content
    ^
    |---- cursor moves to beginning of text...once cursor is at beginning of text, press tab

html
  body
    #container
      .content
      ^
      |---- now line is maximum indented, press tab again

html
  body
    #container
.content
^
|---- line moves to minimum indentation level (no indentation)

Regions can be indentend in a similar way; however, this is still buggy...

Since jade and stylus nesting is somewhat related to sexp layout I hope to have sexp related selection & manipulation working in the future. See jade-highlight-sexp for an example

key bindings

  • [tab] if region is active, do 'smart indent' on region. otherwise, move cursor to beginning of line text. If cursor already at beginning of line text, do 'smart indent' on line.
  • [shift-tab] if region is active, do 'smart dedent' on region. otherwise, move cursor to beginning of line text. If cursor already at beginning of line text, do 'smart dedent' on line.

jade-mode

Emacs major mode for jade template highlighting. This mode extends sws-mode to provide some rudimentary syntax highlighting.

Still in very early stages. Some simple highlighting of tags, ids, and classes works; however, it highlights incorrectly into the javascript code and plain text code as well.

I would like to get the highlighting working better. Also note javascript highlighting with either js2-mode or espresso-mode should be possible...I'm a major major-mode writing noob so it'll take a while.

stylus-mode

I'm not sure yet how to highlight .styl files, so for now, just use sws-mode when editing stylus mode.

Installation instructions

Copy the jade-mode.el and sws-mode.el to some directory on your computer. I put mine under ~/code/jade-mode and sym-link the jade-mode folder into ~/.emacs.d/vendor/. You can just as easily put the folder itself under '~/.emacs.d/vendor/`

Add the following lines to any of your initialization files

(add-to-list 'load-path "~/.emacs.d/vendor/jade-mode")
(require 'sws-mode)
(require 'jade-mode)    
(add-to-list 'auto-mode-alist '("\\.styl$" . sws-mode))
(add-to-list 'auto-mode-alist '("\\.jade$" . jade-mode))

jade-mode's People

Contributors

brianc avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.