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.
This project is licensed under The 2-Clause BSD License (BSD-2-Clause) — see the LICENSE file in this project for details.
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 onIf 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.gitIf 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.gitIf 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.
To configure indentation in purescript-vim you can use the following variables:
Disable indentation altogether.
let g:purescript_disable_indent = 1let g:purescript_indent_case = 5 case xs of
>>>>>[] -> ...
>>>>>(y:ys) -> ...let g:purescript_indent_let = 4 let x = 0 in
>>>>xlet g:purescript_indent_in = 1 let x = 0
>in xlet g:purescript_indent_where = 6 where f :: Int -> Int
>>>>>>f x = xlet g:purescript_indent_do = 3 do x <- a
>>>y <- blet g:purescript_indent_dot = 1 unsnoc
:: forall a
>. List a
-> Maybe (List a, a)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 <<< sumMod2let g:purescript_unicode_conceal_enable = 1Enables 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 ∘ sumMod2let g:purescript_unicode_conceal_disable_common = 1Disables 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 <<< sumMod2let g:purescript_unicode_conceal_enable_discretionary = 1Enables 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 ∘ sumMod2Grab the suggested Git config by including with
$ git config --local include.path ../.gitconfigThis includes .git-blame-ignore-revs.
Enter Nix dev shell (enable Flakes if needed)
$ nix developOr you can get an automatic shell via direnv
$ echo "use flake" > .envrc
$ direnv allowYou can contribute to purescript-vim in several ways:
-
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.
-
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.
-
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.