GithubHelp home page GithubHelp 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
  9. Integration with elm-test

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:

TAGS

Keybinding Description
C-c M-t Generate a TAGS file for the current project.
C-c . Jump to tag at point.
C-c , Jump to previous location after visiting a tag.

TAGS file generation requires that the UNIX find, egrep commands and the Emacs etags command be available in your path.

Set or customize elm-tags-on-save to t to generate a new TAGS file for the current project on every save.

Set or customize elm-tags-exclude-elm-stuff to nil to include source files inside elm-stuff directories when generating the TAGS file.

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.
C-c C-a Add missing type annotations to the current buffer.
C-u C-c C-a Add missing type annotations to the current buffer, prompting before each change.
C-c C-r Clean up imports in the current buffer.
C-u C-c C-r Clean up imports in the current buffer, prompting before each change.

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 C-s Sort the imports in the current file.
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.

Set or customize elm-sort-imports-on-save to t to apply elm-sort-imports 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.
C-c M-d Show the documentation of the function at point.

elm-mode supports auto-completion through elm-oracle. To use [company-mode][company] for auto-completion, add the Elm backend to the backend list:

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

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

Here's a screenshot of company-mode in action:

company-mode

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.

Set or customize elm-format-elm-version to change which version of Elm to format against. Valid options are 0.17 and 0.16. The default is 0.17.

elm-test

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

Keybinding Description
C-c t Run the test suite for the current project.

elm-mode's People

Contributors

aluuu avatar appleby avatar avh4 avatar bogdanp avatar chalmagean avatar crodjer avatar donataswix avatar ento avatar jcollard avatar m4b avatar menschenkindlein avatar osnr avatar purcell avatar rntz avatar sarquella avatar savuori avatar wobh avatar yasuyk avatar

Watchers

 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.