Awesome
<!-- markdownlint-disable --> <br /> <div align="center"> <a href="https://github.com/mrcjkb/haskell-snippets.nvim"> <img src="./logo.svg" alt="haskell-snippets.nvim"> </a> <p align="center"> <a href="https://github.com/mrcjkb/haskell-snippets.nvim/issues">Report Bug</a> </p> <p> <strong> My collection of Haskell snippets for <a href="https://github.com/L3MON4D3/LuaSnip">LuaSnip</a>. <br /> Powered by <a href="https://github.com/nvim-treesitter/nvim-treesitter">tree-sitter</a> and LSP. </strong> </p> <h2>🦥</h> </div> <!-- markdownlint-restore -->Quick Links
Installation
Use luarocks or your favourite plugin manager.
Required
neovim >= 0.8
luasnip
Optional
haskell-language-server
andhaskell-tools.nvim
(some snippets work better with LSP).- A Haskell tree-sitter parser or
nvim-treesitter
and the parser for haskell.
Quick setup
Add the following to your LuaSnip setup.
local ls = require('luasnip')
ls.setup {
-- Add your LuaSnip config
}
local haskell_snippets = require('haskell-snippets').all
ls.add_snippets('haskell', haskell_snippets, { key = 'haskell' })
[!NOTE]
See also
:h haskell-snippets
Snippets
[!NOTE]
- The recording software ttyrec sometimes has some visual glitches.
- Many snippets provided by this plugin use choice nodes recursively.
Pragmas
haskell-snippets.pragmas.prag
- Trigger:
prag
haskell-snippets.pragmas.lang
- Trigger:
lang
haskell-snippets.pragmas.discover
- Trigger:
discover
haskell-snippets.pragmas.nowarn
- Trigger:
nowarn
Module and imports
haskell-snippets.module.mod
- Trigger:
mod
haskell-snippets.module.qual
- Trigger:
qual
haskell-snippets.module.impc
- Trigger:
impc
- Requires a tree-sitter parser for Haskell.
haskell-snippets.module.qualc
- Trigger:
qualc
- Requires a tree-sitter parser for Haskell.
Data and typeclasses
haskell-snippets.data.adt
- Trigger:
adt
haskell-snippets.data.newtype
- Trigger:
new
haskell-snippets.data.rec
- Trigger:
rec
haskell-snippets.data.cls
- Trigger:
cls
haskell-snippets.data.ins
- Trigger:
ins
haskell-snippets.data.constraint
- Trigger:
=>
Functions
haskell-snippets.functions.fn
- Trigger:
fn
haskell-snippets.functions.func
- Trigger:
func
haskell-snippets.functions.lambda
- Trigger:
\
Expressions
haskell-snippets.expressions.if_expr
- Trigger:
if
haskell-snippets.expressions.if_expr_multiline
- Trigger:
iff
- Trigger:
case
haskell-snippets.expressions.if_expr_multiway
- Trigger:
ifmw
haskell-snippets.expressions.lambdacase
- Trigger:
\case
QuasiQuotes
haskell-snippets.quasiquotes.qq
- Trigger:
qq
haskell-snippets.quasiquotes.sql
- Trigger:
sql
Contributing
All contributions are welcome! See CONTRIBUTING.md.
Recommendations
Here are some other plugins I recommend for Haskell development:
- mrcjkb/haskell-tools.nvim: Toolset to improve the Haskell experience in Neovim.
- neotest-haskell: Interact with tests in neovim.
- luc-tielen/telescope_hoogle: Hoogle search.