Giter VIP home page Giter VIP logo

elm.vim's Introduction

elm.vim

Vim plugin for the Elm programming language.

Installation

Just like any other plugin, clone this repository into the ~/.vim/bundle directory

cd ~/.vim/bundle && \
git clone https://github.com/lambdatoast/elm.vim.git

If you are unfamiliar with this process, please refer to the Pathogen project.

System Requirements

Nothing other than vim is needed for the syntax highlighting.

For the special commands and aliases (for compilation, etc), the plugin expects the following programs to be available:

  • elm-make: The Elm build tool.
  • elm-repl: The Elm REPL. The plugin sends it bits of code for evaluation.

Usage

These are the available commands. To get the most out of them, you should create mappings according to your needs.

Compilation

  • :ElmMakeCurrentFile compiles the current file.
  • :ElmMakeMain compiles an assumed Main.elm file.
  • :ElmMakeFile <filename> compiles filename.

Evaluation

  • :ElmEvalLine evaluates the current line and puts the result as a comment in a new line below it.
  • :ElmEvalSelection evaluates a visual mode selection.

REPL

  • :ElmRepl switches to elm-repl, when closing the REPL you'll get back to vim.

Example mappings

I use the following mappings in my .vimrc at the moment:

nnoremap <leader>el :ElmEvalLine<CR>
vnoremap <leader>es :<C-u>ElmEvalSelection<CR>
nnoremap <leader>em :ElmMakeCurrentFile<CR>

Example autocommands

Vim autocommands can make your life a lot easier. These are just some examples of what I use sometimes:

  • Compiling the current file on write:
    • :au BufWritePost *.elm ElmMakeCurrentFile
  • Usually more useful: Compiling a specific file, e.g. "Main.elm", on file write to any file in the project:
    • :au BufWritePost *.elm ElmMakeFile("Main.elm")

Remember you can clear all these afterwards, with e.g. :au! BufWritePost *.elm

TODO

  • Integration with Elm docs.

elm.vim's People

Contributors

lambdatoast avatar otavialabs avatar hoosieree avatar qzchenwl avatar japesinator avatar benblazak avatar jcorbin avatar rgrinberg avatar kasbah avatar

Watchers

 avatar 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.