Giter Club home page Giter Club logo

elm-mode's Introduction

elm-mode

Elm mode for Emacs.

Features

  1. Syntax highlighting.
  2. Intelligent indentation.
  3. Integration with elm-make.
  4. Integration with elm-repl.
  5. Integration with elm-reactor.
  6. Integration with elm-package.
  7. Integration with elm-oracle
  8. Integration with elm-format

Indentation

elm-mode indentation is based on cycling: every time you insert a new line there will be one or more indentation levels available for you to choose from. The exact number is printed in the minibuffer either as Sole indentation or Indent cycle (n)... where n is the number of available indentations to choose from. If the automatic indentation level was not the one you expected simply hit TAB to cycle through the list (note that hitting any other key will cancel the cycle).

Installation

MELPA

If your Emacs has package.el (which is automatically the case for Emacs >= 24), you can install elm-mode from the package in MELPA.

From source

Add this repo to your load-path and (require 'elm-mode). Ensure that the following dependencies are available:

This package assumes you are runing Emacs 24 or later.

Bindings

The following bindings are available in elm-mode:

elm-make

Keybinding Description
C-c C-c Compile the current buffer.
C-u C-c C-c Compile the current buffer, specifying the output file.
C-c M-c Compile the Main.elm file.
C-u C-c M-c Compile the Main.elm file, specifying the output file.

elm-repl

Keybinding Description
C-c C-l Load the current file in a REPL.
C-c C-p Push the current region to a REPL.
C-c C-e Push the current decl. to a REPL (requires haskell-mode).

elm-reactor

Keybinding Description
C-c C-n Preview the current buffer in a browser.
C-u C-c C-n Preview the current buffer in a browser in debug mode.
C-c C-m Preview the Main.elm file in a browser.
C-u C-c C-m Preview the Main.elm file in a browser in debug mode.

elm-package

Keybinding Description
C-c C-d View a function's documentation in a browser.
C-c C-i Import a module from one of the dependencies.
C-c M-k Open the package catalog.
C-u C-c M-k Open the package catalog, refreshing the package list first.

The following bindings are available in the package list buffer:

Keybinding Description
g Refresh package list.
n Next package.
p Previous package.
v View package in browser.
m Mark package for installation.
i Mark package for installation.
u Unmark package.
x Install marked packages.

elm-format

The following functionality requires elm-format to be installed. elm-format does not come with the Elm installer so you will have to install it manually.

Keybinding Description
C-c C-f Automatically format the current buffer.

Set or customize elm-format-on-save to t to apply elm-format on the current buffer on every save.

elm-oracle

The following functionality requires elm-oracle to be installed. elm-oracle does not come with the Elm installer so you will have to install it manually.

Keybinding Description
C-c C-t Show the type of the function at point in the minibuffer.

elm-mode supports auto completion through elm-oracle. To enable basic completion (either with company-mode or Emacs' completion-at-point) add elm-oracle-setup-completion to the elm-mode-hook like so:

(add-hook 'elm-mode-hook #'elm-oracle-setup-completion)

If you want to use company for autocompletion all you need to do is add the provided backend to the provider list:

(add-to-list 'company-backends 'company-elm)

The company backend supports company-quickhelp as well to display documentation snippets for the autocompletion candidates.

If you prefer to use auto-complete as your completion backend you can instead do the following after setting up auto-complete according to its manual:

(add-hook 'elm-mode-hook #'elm-oracle-setup-ac)

Note that the completion process is synchronous so you should set ac-auto-start to a large value or to nil otherwise you will experience slowdown. This will be improved in the future.

Here's a screenshot of auto-complete in action:

auto-complete

elm-mode's People

Contributors

bogdanp avatar jcollard avatar purcell avatar m4b avatar yasuyk avatar sarquella avatar aluuu avatar ento avatar rntz avatar osnr avatar crodjer avatar savuori avatar avh4 avatar

Watchers

James Cloos 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.