1
Fork 0

Set up haskell-tools.nvim

This commit is contained in:
Matei Adriel 2023-09-22 21:08:11 +03:00
parent c8d7224dc9
commit 346d1b78d9
No known key found for this signature in database
10 changed files with 128 additions and 95 deletions

View file

@ -1,6 +1,12 @@
# shell containing the tools i most commonly use for haskell work!
{ pkgs, ... }:
pkgs.mkShell {
buildInputs = with pkgs; [ ghc hpack stack cabal-install ];
buildInputs = with pkgs; [
ghc
hpack
stack
cabal-install
haskellPackages.implicit-hie # Automatically generate hie.yaml!
];
}

View file

@ -10,9 +10,7 @@
"library": {
"enabled": true,
"types": true,
"plugins": [
"scrap"
],
"plugins": true,
"runtime": true
}
}

View file

@ -33,106 +33,106 @@ vim.opt.foldmethod = "expr"
local abbreviations = {
-- {{{ Greek chars
{ "eps", "\\epsilon" },
{ "delta", "\\delta" },
{ "Delta", "\\Delta" },
{ "pi", "\\pi" },
{ "psi", "\\psi" },
{ "alpha", "\\alpha" },
{ "beta", "\\beta" },
{ "theta", "\\theta" },
{ "gamma", "\\gamma" },
{ "lam", "\\lambda" },
{ "eps", "\\epsilon" },
{ "delta", "\\delta" },
{ "Delta", "\\Delta" },
{ "pi", "\\pi" },
{ "psi", "\\psi" },
{ "alpha", "\\alpha" },
{ "beta", "\\beta" },
{ "theta", "\\theta" },
{ "gamma", "\\gamma" },
{ "lam", "\\lambda" },
{ "lambda", "\\lambda" },
{ "omega", "\\omega" },
{ "Omega", "\\Omega" },
{ "nuls", "\\varnothing" },
{ "omega", "\\omega" },
{ "Omega", "\\Omega" },
{ "nuls", "\\varnothing" },
-- }}}
-- Other fancy symvols
{ "tmat", "^T" }, -- Tranpose of a matrix
{ "cmat", "^*" }, -- Conjugate of a matrix
{ "sneg", "^C" }, -- Set complement
{ "ortco", "^{\\bot}" }, -- Orthogonal complement
{ "tmat", "^T" }, -- Tranpose of a matrix
{ "cmat", "^*" }, -- Conjugate of a matrix
{ "sneg", "^C" }, -- Set complement
{ "ortco", "^{\\bot}" }, -- Orthogonal complement
{ "sinter", "^{\\circ}" }, -- Interior of a set
-- Basic commands
{ "mangle", "\\measuredangle" },
{ "aangle", "\\angle" },
{ "sdiff", "\\setminus" },
{ "sst", "\\subset" },
{ "spt", "\\supset" },
{ "sseq", "\\subseteq" },
{ "speq", "\\supseteq" },
{ "nin", "\\not\\in" },
{ "iin", "\\in" },
{ "tto", "\\to" },
{ "land", "\\land" },
{ "lor", "\\lor" },
{ "ssin", "\\sin" },
{ "ccos", "\\cos" },
{ "ttan", "\\ttan" },
{ "ssec", "\\sec" },
{ "lln", "\\ln" },
{ "frl", "\\forall" },
{ "exs", "\\exists" },
{ "iinf", "\\infty" },
{ "ninf", "-\\infty" },
{ "nlnl", "\\pm" }, -- had this as npnp first but it was hard-ish to type
{ "ccup", "\\cup" },
{ "ccap", "\\cap" },
{ "nope", "\\bot" },
{ "yee", "\\top" },
{ "ccan", "\\cancel" },
{ "com", "\\circ" },
{ "mul", "\\cdot" },
{ "smul", "\\times" },
{ "card", "\\#" },
{ "div", "\\|" },
{ "ndiv", "\\not\\|\\:" },
{ "perp", "\\perp" },
{ "sdiff", "\\setminus" },
{ "sst", "\\subset" },
{ "spt", "\\supset" },
{ "sseq", "\\subseteq" },
{ "speq", "\\supseteq" },
{ "nin", "\\not\\in" },
{ "iin", "\\in" },
{ "tto", "\\to" },
{ "land", "\\land" },
{ "lor", "\\lor" },
{ "ssin", "\\sin" },
{ "ccos", "\\cos" },
{ "ttan", "\\ttan" },
{ "ssec", "\\sec" },
{ "lln", "\\ln" },
{ "frl", "\\forall" },
{ "exs", "\\exists" },
{ "iinf", "\\infty" },
{ "ninf", "-\\infty" },
{ "nlnl", "\\pm" }, -- had this as npnp first but it was hard-ish to type
{ "ccup", "\\cup" },
{ "ccap", "\\cap" },
{ "nope", "\\bot" },
{ "yee", "\\top" },
{ "ccan", "\\cancel" },
{ "com", "\\circ" },
{ "mul", "\\cdot" },
{ "smul", "\\times" },
{ "card", "\\#" },
{ "div", "\\|" },
{ "ndiv", "\\not\\|\\:" },
{ "perp", "\\perp" },
-- Custom commands
{ "abs", "\\abs" }, -- custom abs command
{ "norm", "\\norm" }, -- custom norm command
{ "iprod", "\\iprod" }, -- custom inner product command
{ "abs", "\\abs" }, -- custom abs command
{ "norm", "\\norm" }, -- custom norm command
{ "iprod", "\\iprod" }, -- custom inner product command
{ "diprod", "\\dprod" }, -- custom self inner product command
{ "prob", "\\prob" }, -- custom probability function
{ "dist", "\\dist" }, -- custom dist function
{ "diam", "\\diam" }, -- custom diam operator
{ "gen", "\\gen" }, -- custom command for group generated by element
{ "ord", "\\ordop" }, -- order of a group
{ "vsm", "\\vecspace" }, -- custom math vector space
{ "prob", "\\prob" }, -- custom probability function
{ "dist", "\\dist" }, -- custom dist function
{ "diam", "\\diam" }, -- custom diam operator
{ "gen", "\\gen" }, -- custom command for group generated by element
{ "ord", "\\ordop" }, -- order of a group
{ "vsm", "\\vecspace" }, -- custom math vector space
}
-- Todo: convert exponents and subscripts
-- to use this more concise notation.
local abolishAbbreviations = {
-- {{{ General phrases
{ "thrf", "therefore" },
{ "bcla", "by contradiction let's assume" },
{ "wlg", "without loss of generality" },
{ "tits", "that is to say," },
{ "wpbd", "we will prove the statement in both directions." },
{ "stam{,s}", "statement{}" },
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" },
{ "cex{,s}", "counterexample{}" },
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
{ "thrf", "therefore" },
{ "bcla", "by contradiction let's assume" },
{ "wlg", "without loss of generality" },
{ "tits", "that is to say," },
{ "wpbd", "we will prove the statement in both directions." },
{ "stam{,s}", "statement{}" },
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" },
{ "cex{,s}", "counterexample{}" },
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
-- }}}
-- {{{ Calculus & analysis
{ "ib{p,s}", "integration by {parts,substitution}" },
{ "nb{,h}{,s}", "neighbour{,hood}{}" },
{ "ib{p,s}", "integration by {parts,substitution}" },
{ "nb{,h}{,s}", "neighbour{,hood}{}" },
-- }}}
-- {{{ Linear algebra
{ "rref", "reduced row echalon form" },
{ "rref", "reduced row echalon form" },
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
{ "mx{,s}", "matri{x,ces}" },
{ "dete{,s}", "determinant{}" },
{ "ort{n,g}", "orto{normal,gonal}" },
{ "l{in,de}", "linearly {independent,dependent}" },
{ "lcon{,s}", "linear combination{}" },
{ "vst{,s}", "vector space{}" }, -- text vector space
{ "mx{,s}", "matri{x,ces}" },
{ "dete{,s}", "determinant{}" },
{ "ort{n,g}", "orto{normal,gonal}" },
{ "l{in,de}", "linearly {independent,dependent}" },
{ "lcon{,s}", "linear combination{}" },
{ "vst{,s}", "vector space{}" }, -- text vector space
{
"rizz", -- ok please ignore this one 💀
"rizz", -- ok please ignore this one 💀
"Riesz vector",
options = A.no_capitalization,
},
@ -145,7 +145,7 @@ local abolishAbbreviations = {
},
-- }}}
-- {{{ Graph theory
{ "vx{,s}", "vert{ex,ices}" },
{ "vx{,s}", "vert{ex,ices}" },
{ "edg{,s}", "edge{}" },
-- Graph theory function syntax:

View file

@ -18,6 +18,7 @@
"github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
"haskell-tools.nvim": { "branch": "master", "commit": "b19df600da8ef5fb4fb280815415ebd2a4228f0f" },
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
"hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" },
"idris2-nvim": { "branch": "main", "commit": "3a2b4d2b5ffeab9e47298456c59c31b4e1ddebc9" },
@ -64,7 +65,6 @@
"typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" },
"undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" },
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
"vim-abolish": { "branch": "master", "commit": "cb3dcb220262777082f63972298d57ef9e9455ec" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
"vim-tmux-navigator": { "branch": "master", "commit": "cdd66d6a37d991bba7997d593586fc51a5b37aa8" },

View file

@ -0,0 +1,24 @@
local lspconfig = require("my.plugins.lspconfig")
local M = {
"mrcjkb/haskell-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
version = "^2",
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
}
function M.config()
vim.g.haskell_tools = {
hls = {
on_attach = lspconfig.on_attach,
},
tools = {
hover = {
enable = false,
},
},
}
end
return M

View file

@ -97,8 +97,10 @@ end
-- {{{ General server config
---@type lspconfig.options
---@diagnostic disable-next-line: missing-fields
local servers = {
-- {{{ Typescript
---@diagnostic disable-next-line: missing-fields
tsserver = {
on_attach = function(client, bufnr)
-- We handle formatting using null-ls and prettierd
@ -110,6 +112,7 @@ local servers = {
-- {{{ Purescript
purescriptls = {
settings = {
---@diagnostic disable-next-line: missing-fields
purescript = {
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
formatter = "purs-tidy",
@ -117,16 +120,6 @@ local servers = {
},
},
-- }}}
-- {{{ Haskell
hls = {
settings = {
haskell = {
-- set formatter
formattingProvider = "fourmolu",
},
},
},
-- }}}
-- {{{ Lua
lua_ls = {
cmd = {
@ -134,6 +127,7 @@ local servers = {
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
},
settings = {
---@diagnostic disable-next-line: missing-fields
Lua = {
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
@ -174,10 +168,13 @@ local servers = {
nil_ls = {},
nixd = {},
-- }}}
---@diagnostic disable-next-line: missing-fields
cssls = {},
---@diagnostic disable-next-line: missing-fields
jsonls = {},
dhall_lsp_server = {},
typst_lsp = {},
---@diagnostic disable-next-line: missing-fields
elmls = {},
-- {{{ Inactive
-- pylsp = {},

View file

@ -2,7 +2,7 @@ local env = require("my.helpers.env")
local M = {
"L3MON4D3/LuaSnip", -- snippeting engine
cond = env.vscode.not_active()
cond = env.vscode.not_active(),
}
local function reload()

View file

@ -14,6 +14,13 @@
# Direnv
".direnv"
".envrc"
# Haskell
# NOTE: THIS IS A BAD IDEA
# I need to figure out a better way (this is simply here because
# a project I contribute to doesn't gitignore this file, nor does
# it have it commited).
"hie.yaml"
];
aliases = {

View file

@ -51,6 +51,7 @@ let
libstdcxx5 # Required by treesitter aparently
python310Packages.jupytext # Convert between jupyter notebooks and python files
graphviz # For rust crate graph
haskellPackages.hoogle # For haskell search
# Preview
zathura # Pdf reader

View file

@ -48,7 +48,7 @@
let
blacklisted = [
"twitter.com"
"www.reddit.com"
# "www.reddit.com"
# "minesweeper.online"
];
blacklist = lib.concatStringsSep "\n" (lib.forEach blacklisted (host: "127.0.0.1 ${host}"));