Giter Site home page Giter Site logo

vim-reasonml's Introduction

vim-reasonml:

Native Reason development with esy and Merlin

vim-reasonml provides vim IDE features for native Reason projects that use esy and merlin.

Features:

  • Automatically loads Merlin plugin from your esy devDependencies.
  • Merlin autocomplete, goto-location, type-at-cursor features (provided by merlin)
  • Airline integration for esy projects and compilation errors.
  • :ReasonPrettyPrint with enhanced syntax error locations.
  • Reason syntax highlighting and Dune build config syntax highlighting.
  • Highlighting of esy #{build variables} in .json files.
  • Preliminary Windows support with esy Windows.

See The vim-reasonml Plugin Documentation.

Install

  • npm install -g esy
  • Install vim-reasonml with your vim plugin manager. If using vim-plug add Plug 'jordwalke/vim-reasonml' to your ~/.vimrc)
  • Create a project with @opam/merlin as a devDependency. You can fork hello-reason to get started.
  • esy install && esy build as you normally would.
  • Open a .re file from the project in Vim.

Formatting

The command :ReasonPrettyPrint invokes the binary refmt which must be available on your PATH. Add a keyboard mapping shortcut like this:

autocmd FileType reason map <buffer> <D-C> :ReasonPrettyPrint<Cr>

Error/Warning Highlighting:

  • To enable syntastic support, add the following to your ~/.vimrc:
" If using vim-plug, install syntastic:
Plug 'scrooloose/syntastic'
  • Neomake support can be enabled by setting let g:neomake_reason_enabled_makers = ['merlin'].

Merlin

Merlin is supported out of the box by pulling merlin from your devDependencies. You will need to install an autocomplete plugin to get natural complete-as-you-type behavior. For example to install mucomplete, using vim-plug, add the following config:

" If using vim-plug, install mucomplete:
Plug 'lifepillar/vim-mucomplete'
let g:mucomplete#can_complete = {}
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#chains = {'default': ['omni']}

Airline Integration

vim-reasonml includes an airline extension which show the project name of the current file (and project status) in an airline segment. Another included extension shows the current number of syntastic errors and warnings.

" Airline: Enable the airline extensions for esy project status and reason
" syntastic plugin.
let g:airline_extensions = ['esy', 'reason']
let g:reasonml_project_airline=1
let g:reasonml_syntastic_airline=1
let g:reasonml_clean_project_airline=1
let g:airline#extensions#whitespace#enabled = 0
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1

LICENSE

Some files from vim-reasonml are based on the Rust vim plugin and so we are including that license.

vim-reasonml's People

Contributors

jordwalke avatar andreypopp avatar anmonteiro avatar imeckler avatar leostera avatar rizo avatar

Watchers

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