• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Vim Script
  • License
    BSD 2-Clause "Sim...
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Syntax highlighting and indentation for PureScript

purescript-vim

PureScript language support for Vim and Neovim providing syntax highlighting and indentation based on based on idris-vim and haskell-vim.

See purescript-language-server for details on how to set up language server support for PureScript.

License

This project is licensed under The 2-Clause BSD License (BSD-2-Clause) β€” see the LICENSE file in this project for details.

Installation

Manual Installation (no plugin manager)

Copy content of this repository into your ~/.vim directory (or %HOME%\vimfiles on Windows).

Be sure that the following lines are in your .vimrc

syntax on
filetype on
filetype plugin indent on

Vim 8 packages

If you have Vim version 8 (vim --version | head -n1), you can install plugins with the native pack system:

$ mkdir -p ~/.vim/pack/plugins/start/
$ cd ~/.vim/pack/plugins/start/
$ git clone https://github.com/purescript-contrib/purescript-vim.git

Pathogen

If you are using Pathogen, clone this repo into your ~/.vim/bundle directory and you are ready to go.

$ cd ~/.vim/bundle
$ git clone https://github.com/purescript-contrib/purescript-vim.git

vim-plug

If you are using vim-plug, add the following line in between your plug#begin and plug#end calls for your Vim config file:

Plug 'purescript-contrib/purescript-vim'

Save and restart (Neo)Vim and run :PlugInstall.

Configuration

Indentation

To configure indentation in purescript-vim you can use the following variables:

g:purescript_disable_indent

Disable indentation altogether.

let g:purescript_disable_indent = 1

g:purescript_indent_case

let g:purescript_indent_case = 5
        case xs of
        >>>>>[]     -> ...
        >>>>>(y:ys) -> ...

g:purescript_indent_let

let g:purescript_indent_let = 4
        let x = 0 in
        >>>>x

g:purescript_indent_in

let g:purescript_indent_in = 1
        let x = 0
        >in x

g:purescript_indent_where

let g:purescript_indent_where = 6
        where f :: Int -> Int
        >>>>>>f x = x

g:purescript_indent_do

let g:purescript_indent_do = 3
        do x <- a
        >>>y <- b

g:purescript_indent_dot

let g:purescript_indent_dot = 1
  unsnoc
    :: forall a
    >. List a
    -> Maybe (List a, a)

Unicode conceal

If you wish to have some symbols concealed for their Unicode equivalents, you may use these options. Each setting will conceal the following ASCII code block for an example output.

sum :: forall a f. Foldable f => Semiring a => f a -> a
sum = foldl (\a b -> a + b) zero

sumMod2 :: forall f. Foldable f => f Int -> Int
sumMod2 xs = mod (sum xs) 2

isSumEven :: forall f. Foldable => f Int -> Boolean
isSumEven = (==) 0 <<< sumMod2

g:purescript_unicode_conceal_enable

let g:purescript_unicode_conceal_enable = 1

Enables concealing. Conceals as:

sum ∷ βˆ€ a f. Foldable f β‡’ Semiring a β‡’ f a β†’ a
sum = foldl (Ξ»a b β†’ a + b) zero

sumMod2 ∷ βˆ€ f. Foldable f β‡’ f Int β†’ Int
sumMod2 xs = mod (sum xs) 2

isSumEven ∷ βˆ€ f. Foldable β‡’ f Int β†’ Boolean
isSumEven = (≑) 0 ∘ sumMod2

g:purescript_unicode_conceal_disable_common

let g:purescript_unicode_conceal_disable_common = 1

Disables concealing common symbols and just uses ones the compiler supports. Concealed as:

sum ∷ βˆ€ a f. Foldable f β‡’ Semiring a β‡’ f a β†’ a
sum = foldl (\a b β†’ a + b) zero

sumMod2 ∷ βˆ€ f. Foldable f β‡’ f Int β†’ Int
sumMod2 xs = mod (sum xs) 2

isSumEven ∷ βˆ€ f. Foldable β‡’ f Int β†’ Boolean
isSumEven = (==) 0 <<< sumMod2

g:purescript_unicode_conceal_enable_discretionary

let g:purescript_unicode_conceal_enable_discretionary = 1

Enables discretionary symbols concealing less common symbols that deviate further from the written code. Concealed as:

βˆ‘ ∷ βˆ€ a f. Foldable f β‡’ Semiring a β‡’ f a β†’ a
βˆ‘ = foldl (Ξ»a b β†’ a + b) βˆ…

sumMod2 ∷ βˆ€ f. Foldable f β‡’ f β„€ β†’ β„€
sumMod2 xs = mod (βˆ‘ xs) 2

isSumEven ∷ βˆ€ f. Foldable β‡’ f β„€ β†’ 𝔹
isSumEven = (≑) 0 ∘ sumMod2

Developing

Grab the suggested Git config by including with

$ git config --local include.path ../.gitconfig

This includes .git-blame-ignore-revs.

Enter Nix dev shell (enable Flakes if needed)

$ nix develop

Or you can get an automatic shell via direnv

$ echo "use flake" > .envrc
$ direnv allow

Contributing

You can contribute to purescript-vim in several ways:

  1. If you encounter a problem or have a question, please open an issue or post to the mailing list. We’ll do our best to work with you to resolve or answer it.

  2. If you would like to contribute code, tests, or documentation, please read the contributor guide. It’s a short, helpful introduction to contributing to this library, including development instructions.

  3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the PureScript Discourse! Writing libraries and learning resources are a great way to help this library succ:eed.

More Repositories

1

pulp

A build tool for PureScript projects
PureScript
444
star
2

purescript-react

React Bindings for PureScript
PureScript
395
star
3

purescript-aff

An asynchronous effect monad for PureScript
PureScript
281
star
4

purescript-parsing

A parser combinator library based on Parsec
PureScript
150
star
5

purescript-profunctor-lenses

Pure profunctor lenses
PureScript
142
star
6

purescript-affjax

An asynchronous AJAX library built using Aff.
PureScript
121
star
7

purescript-css

A clean, type-safe library for describing, manipulating and rendering CSS
PureScript
105
star
8

purescript-routing

A clean, type-safe routing library for PureScript.
PureScript
104
star
9

purescript-matryoshka

Generalized folds, unfolds, and traversals for fixed point data structures
PureScript
59
star
10

purescript-argonaut-codecs

JSON serialization and deserialization with Argonaut.
PureScript
49
star
11

purescript-argonaut-core

A fast, native representation for JSON, with serialization and folding
PureScript
47
star
12

setup-purescript

Set up a specific PureScript toolchain in your GitHub Actions workflow
JavaScript
46
star
13

purescript-colors

Convert, manipulate, analyze, blend, color scales, color schemes
PureScript
44
star
14

purescript-string-parsers

A parsing library specialized to handling strings
PureScript
43
star
15

purescript-formatters

Formatting and printing for numeric and date/time/interval values
PureScript
41
star
16

purescript-optparse

Applicative option parser
PureScript
40
star
17

purescript-coroutines

Computations which can suspend their execution and return control to their invoker
PureScript
38
star
18

purescript-machines

Finite state machines, including Mealy machines, for modeling computations
PureScript
37
star
19

atom-language-purescript

PureScript language support for the Atom editor
CoffeeScript
34
star
20

purescript-pathy

A type-safe abstraction for platform-independent file system paths.
PureScript
31
star
21

purescript-uri

A type-safe parser, printer, and ADT for URLs and URIs.
PureScript
26
star
22

purescript-bigints

Arbitrary length integers for PureScript
PureScript
26
star
23

purescript-github-actions-toolkit

PureScript wrapper around GitHub's Actions Toolkit
PureScript
25
star
24

purescript-aff-coroutines

Helper functions for creating coroutines with the Aff monad
PureScript
23
star
25

purescript-nullable

A very simple library for dealing with nulls in foreign libraries
PureScript
23
star
26

purescript-argonaut-generic

Generic encoding and decoding functions for data types with a Generic.Rep instance
PureScript
22
star
27

purescript-quickcheck-laws

QuickCheck powered law tests for PureScript's core typeclasses.
PureScript
22
star
28

purescript-freet

Free monad transformers
PureScript
20
star
29

purescript-options

Types and functions for dealing with JavaScript options objects
PureScript
20
star
30

purescript-now

Effect type and functions for accessing the current machine's date and time.
PureScript
19
star
31

purescript-ace

Purescript bindings for the Ace editor
PureScript
19
star
32

purescript-aff-bus

Many-to-many broadcasting
PureScript
16
star
33

purescript-react-dom

Low-level React DOM bindings for PureScript
PureScript
16
star
34

purescript-avar

Low-level interface for asynchronous variables
PureScript
16
star
35

purescript-fixed-points

Types for the least and greatest fixed points of functors.
PureScript
15
star
36

governance

Guidelines and resources for the PureScript Contributors organization
PureScript
15
star
37

purescript-js-date

JavaScript's native date type and corresponding functions.
PureScript
15
star
38

purescript-these

Data type isomorphic to α ∨ β ∨ (α ∧ β)
PureScript
14
star
39

purescript-rationals

Rational numbers for PureScript
PureScript
13
star
40

purescript-argonaut-traversals

Prisms, traversals, and zipper for the Argonaut Json type.
PureScript
11
star
41

purescript-concurrent-queues

An unbounded and bounded queue for concurrent access.
PureScript
10
star
42

purescript-js-promise

PureScript
9
star
43

purescript-http-methods

HTTP method type
PureScript
9
star
44

purescript-js-bigints

PureScript
9
star
45

chnglg

A maintainer and contributor-friendly tool for generating a human-readable CHANGELOG.md
PureScript
8
star
46

purescript-fork

An MTL-style class for monads that support forking
PureScript
8
star
47

purescript-unsafe-reference

Highly unsafe functions for comparing values using the runtime's strict equality.
PureScript
8
star
48

purescript-form-urlencoded

A data type, and encoding / decoding functions for application/x-www-form-urlencoded
PureScript
8
star
49

purescript-js-timers

Low level bindings for JavaScript's timers API
PureScript
7
star
50

purescript-arraybuffer

Bindings and implementation for mutable JavaScript ArrayBuffers.
PureScript
7
star
51

purescript-arraybuffer-types

Type definitions for JavaScript ArrayBuffers
PureScript
7
star
52

purescript-unicode

Unicode character functions.
PureScript
7
star
53

purescript-media-types

Internet media / content / MIME types
PureScript
6
star
54

purescript-uint

32-bit unsigned integer type for PureScript
PureScript
6
star
55

purescript-strings-extra

Additional utilities for the PureScript Strings library.
PureScript
6
star
56

purescript-int64

Signed and unsigned 64-bit integer types for PureScript
JavaScript
5
star
57

purescript-affjax-web

PureScript
5
star
58

purescript-js-promise-aff

PureScript
5
star
59

purescript-js-uri

URI encoding and decoding functions
PureScript
4
star
60

purescript-float32

Float32, single-precision 32-bit floating-point number type.
PureScript
3
star
61

purescript-js-abort-controller

Web/Node bindings to `AbortController`/`AbortSignal`
PureScript
2
star
62

purescript-affjax-node

PureScript
2
star
63

purescript-js-blob

PureScript
1
star