Git Product home page Git Product logo

elm-vim's Introduction

elm-vim Release

Elm elm-lang support for Vim.

Compatibility

This plugin requires the error reporting features from Elm Platform 0.15.1 or above.

Features

  • Improved Syntax highlighting, including backtick operators, booleans, chars, triple quotes, string escapes, and tuple functions
  • Improved Indentation
  • Commands and mappings for interfacing with the elm platform
  • Auto-complete

Check out this ElmCast video for more detail.

Install

Elm-vim follows the standard runtime path structure, so you should use a common and well known plugin manager to install it. Do not use elm-vim with other Elm plugins.

  • Pathogen
  • git clone https://github.com/elmcast/elm-vim.git ~/.vim/bundle/elm-vim
  • vim-plug
  • Plug 'elmcast/elm-vim'
  • NeoBundle
  • NeoBundle 'elmcast/elm-vim'
  • Vundle
  • Plugin 'elmcast/elm-vim'
  • Manually
    • Copy all of the files into your ~/.vim directory

Please be sure all necessary binaries are installed (such as elm-make, elm-doc, elm-reactor, etc..) from http://elm-lang.org/.

You may also want to install elm-test with npm install -g elm-test if you want to run unit tests from within vim.

You may also want to install elm-oracle with npm install -g elm-oracle if you want to query docs and types from within vim.

Usage

Many of the features are enabled by default. There are no additional settings needed. All usages and commands are listed in doc/elm-vim.txt.

:help elm-vim
  • :ElmMake [filename] calls elm-make with the given file. If no file is given it uses the current file being edited.

  • :ElmMakeMain attempts to call elm-make with "Main.elm".

  • :ElmTest calls elm-test with the given file. If no file is given it attempts to run the tests in 'Test[filename].elm'.

  • :ElmRepl runs elm-repl, which will return to vim on exiting.

  • :ElmErrorDetail shows the detail of the current error in the quickfix window.

  • :ElmShowDocs queries elm-oracle, then echos the type and docs for the word under the cursor.

  • :ElmBrowseDocs queries elm-oracle, then opens docs web page for the word under the cursor.

Mappings

Elm-vim has several <Plug> mappings which can be used to create custom mappings. Below are some examples you might find useful:

au FileType elm nmap <leader>b <Plug>(elm-make)
au FileType elm nmap <leader>m <Plug>(elm-make-main)
au FileType elm nmap <leader>t <Plug>(elm-test)
au FileType elm nmap <leader>r <Plug>(elm-repl)
au FileType elm nmap <leader>e <Plug>(elm-error-detail)
au FileType elm nmap <leader>d <Plug>(elm-show-docs)
au FileType elm nmap <leader>w <Plug>(elm-browse-docs)

Settings

Below are some (default) settings you might find useful to change.

let g:elm_jump_to_error = 1
let g:elm_make_output_file = "elm.js"
let g:elm_make_show_warnings = 0
let g:elm_browser_command = ""
let g:elm_detailed_complete = 0

Indentation

The current indentation function is still rough, but should work for a lot of cases. It is not always possible to know the perfect indentation level just from context, but we should be able to generate a list of candidates.

Credits

  • Other vim-plugins, thanks for inspiration (elm.vim, ocaml.vim, haskell-vim)
  • Contributors of elm-vim

License

The BSD 3-Clause License - see LICENSE for more details

elm-vim's People

Contributors

gabrielflorit avatar mikker avatar vito avatar

Watchers

 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.