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! # shell containing the tools i most commonly use for haskell work!
{ pkgs, ... }: { pkgs, ... }:
pkgs.mkShell { 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": { "library": {
"enabled": true, "enabled": true,
"types": true, "types": true,
"plugins": [ "plugins": true,
"scrap"
],
"runtime": true "runtime": true
} }
} }

View file

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

View file

@ -18,6 +18,7 @@
"github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" }, "github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
"haskell-tools.nvim": { "branch": "master", "commit": "b19df600da8ef5fb4fb280815415ebd2a4228f0f" },
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
"hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" }, "hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" },
"idris2-nvim": { "branch": "main", "commit": "3a2b4d2b5ffeab9e47298456c59c31b4e1ddebc9" }, "idris2-nvim": { "branch": "main", "commit": "3a2b4d2b5ffeab9e47298456c59c31b4e1ddebc9" },
@ -64,7 +65,6 @@
"typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" }, "typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" },
"undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" },
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" }, "venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
"vim-abolish": { "branch": "master", "commit": "cb3dcb220262777082f63972298d57ef9e9455ec" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" }, "vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
"vim-tmux-navigator": { "branch": "master", "commit": "cdd66d6a37d991bba7997d593586fc51a5b37aa8" }, "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 -- {{{ General server config
---@type lspconfig.options ---@type lspconfig.options
---@diagnostic disable-next-line: missing-fields
local servers = { local servers = {
-- {{{ Typescript -- {{{ Typescript
---@diagnostic disable-next-line: missing-fields
tsserver = { tsserver = {
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
-- We handle formatting using null-ls and prettierd -- We handle formatting using null-ls and prettierd
@ -110,6 +112,7 @@ local servers = {
-- {{{ Purescript -- {{{ Purescript
purescriptls = { purescriptls = {
settings = { settings = {
---@diagnostic disable-next-line: missing-fields
purescript = { purescript = {
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" }, censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
formatter = "purs-tidy", formatter = "purs-tidy",
@ -117,16 +120,6 @@ local servers = {
}, },
}, },
-- }}} -- }}}
-- {{{ Haskell
hls = {
settings = {
haskell = {
-- set formatter
formattingProvider = "fourmolu",
},
},
},
-- }}}
-- {{{ Lua -- {{{ Lua
lua_ls = { lua_ls = {
cmd = { cmd = {
@ -134,6 +127,7 @@ local servers = {
"--logpath=/home/adrielus/.local/share/lua-language-server/log", "--logpath=/home/adrielus/.local/share/lua-language-server/log",
}, },
settings = { settings = {
---@diagnostic disable-next-line: missing-fields
Lua = { Lua = {
-- Do not send telemetry data containing a randomized but unique identifier -- Do not send telemetry data containing a randomized but unique identifier
telemetry = { telemetry = {
@ -174,10 +168,13 @@ local servers = {
nil_ls = {}, nil_ls = {},
nixd = {}, nixd = {},
-- }}} -- }}}
---@diagnostic disable-next-line: missing-fields
cssls = {}, cssls = {},
---@diagnostic disable-next-line: missing-fields
jsonls = {}, jsonls = {},
dhall_lsp_server = {}, dhall_lsp_server = {},
typst_lsp = {}, typst_lsp = {},
---@diagnostic disable-next-line: missing-fields
elmls = {}, elmls = {},
-- {{{ Inactive -- {{{ Inactive
-- pylsp = {}, -- pylsp = {},

View file

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

View file

@ -14,6 +14,13 @@
# Direnv # Direnv
".direnv" ".direnv"
".envrc" ".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 = { aliases = {

View file

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

View file

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