Add custom
type for pkgs.yaml for elixirls
Also let nvim plugins handle the system-open thing
This commit is contained in:
parent
ea0303386b
commit
88d2ac0377
10 changed files with 176 additions and 135 deletions
|
@ -21,6 +21,7 @@ This Neovim config used to live within [my dotfiles](/FollieHiyuki/dotfiles-ansi
|
|||
### Additional DAP/LSP servers
|
||||
|
||||
- elixirls (config for `nvim-lspconfig` and `nvim-dap` + install script)
|
||||
- mdx_analyzer
|
||||
- denols
|
||||
- ocamllsp
|
||||
- vscode-js-debug (config for `nvim-dap` + install script)
|
||||
|
@ -47,6 +48,7 @@ This Neovim config used to live within [my dotfiles](/FollieHiyuki/dotfiles-ansi
|
|||
- venv-selector.nvim
|
||||
- virtual-types.nvim
|
||||
- hover.nvim
|
||||
- nvim-dap-repl-highlights
|
||||
- nvim-tree.lua -> neo-tree???
|
||||
|
||||
### Logic
|
||||
|
|
|
@ -16,6 +16,7 @@ vim.filetype.add {
|
|||
http = 'http',
|
||||
hurl = 'hurl',
|
||||
k = 'kcl',
|
||||
mdx = 'markdown.mdx',
|
||||
mmd = 'mermaid',
|
||||
ncl = 'nickel',
|
||||
nft = 'nftables',
|
||||
|
|
5
go.mod
5
go.mod
|
@ -7,6 +7,8 @@ require (
|
|||
github.com/goccy/go-yaml v1.11.2
|
||||
github.com/magefile/mage v1.15.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
golang.org/x/sync v0.4.0
|
||||
mvdan.cc/sh/v3 v3.7.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -19,7 +21,8 @@ require (
|
|||
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/sys v0.6.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/term v0.8.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
)
|
||||
|
|
15
go.sum
15
go.sum
|
@ -1,8 +1,10 @@
|
|||
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
|
||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
|
@ -15,6 +17,8 @@ github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QX
|
|||
github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ=
|
||||
github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
|
||||
|
@ -25,6 +29,7 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
|
|||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 h1:3RPlVWzZ/PDqmVuf/FKHARG5EMid/tl7cv54Sw/QRVY=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
@ -39,11 +44,15 @@ golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
|||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
|
@ -52,3 +61,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
|||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg=
|
||||
mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8=
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "976e7e3e9c400b99f1cb337b2ce804a9652571ec" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "3a3baf0930444c78d19964fdb401bd3a6a23270f" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "b32a272176d81938cac71a0b85f21f029c1ee8e6" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "8e4090bf9412e24b05823c771cb3956c2ba72981" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
|
||||
"better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
|
||||
"carbon-now.nvim": { "branch": "main", "commit": "3caa535a6216a8f3152708ae0fe6087b76e58639" },
|
||||
|
@ -12,11 +12,11 @@
|
|||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"conform.nvim": { "branch": "master", "commit": "3d639d6155a63e3143920b739cee02f3faa1b4db" },
|
||||
"conform.nvim": { "branch": "master", "commit": "2c1e852fbf723b7d89b14fd28089472d92edeeb9" },
|
||||
"dial.nvim": { "branch": "master", "commit": "019bbe9daea397c93a99adc747f8f071379fee5c" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" },
|
||||
"emmylua-nvim": { "branch": "master", "commit": "306432bb1179efc504ba3403a748c4967e9e8e0c" },
|
||||
"emmylua-nvim": { "branch": "master", "commit": "f558804505670c0490b73ab1002cbc199bb92b41" },
|
||||
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "896261933afe2fddf6fb043d9cd4d88301b151a9" },
|
||||
|
@ -24,10 +24,10 @@
|
|||
"headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" },
|
||||
"heirline.nvim": { "branch": "master", "commit": "7f1e805dfc001d5dbb7d894105063f463f6c7dcc" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "64fdadb3ada61c4297452f7662789b01ee82ffcb" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" },
|
||||
"iswap.nvim": { "branch": "master", "commit": "e05889db694524f68eb69567a70a98470994b890" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "9e3f99fbbd28aaec80dc0158c43be8cca8dd5017" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mini.ai": { "branch": "main", "commit": "fc9ce93eb8d58ce1a39101928fb5ea8f8b97844c" },
|
||||
"mini.align": { "branch": "main", "commit": "e3a0c114d3fea0479f8e8ee3e273c7ca4ba6ea8d" },
|
||||
|
@ -39,7 +39,7 @@
|
|||
"mini.surround": { "branch": "main", "commit": "862cfaef72d789d320625ec34e2488a5cc8fd423" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "00dcf2b81c45de1768b4171faa16729f0888cfb8" },
|
||||
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
|
||||
"neogit": { "branch": "master", "commit": "05899be06d611c485cfb6e17ef6e3b695de67b62" },
|
||||
"neogit": { "branch": "master", "commit": "5a2d4688a80d67dc224375c78e62ffd7dc1e79e6" },
|
||||
"neotest": { "branch": "master", "commit": "901891484db3d46ce43d56871273dc7d40621356" },
|
||||
"neotest-go": { "branch": "main", "commit": "1a15e1136db43775214a3e7a598f8930c29c94b7" },
|
||||
"neotest-jest": { "branch": "main", "commit": "65ab61c77aa1c245f16982ffe1a4d31589e18023" },
|
||||
|
@ -51,7 +51,7 @@
|
|||
"nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" },
|
||||
"nvim-cokeline": { "branch": "main", "commit": "2e71292a37535fdbcf0f9500aeb141021d90af8b" },
|
||||
"nvim-coverage": { "branch": "main", "commit": "13e357d4a2a230070c64ede61252225f0b7d3b5e" },
|
||||
"nvim-dap": { "branch": "master", "commit": "79dbc70eb79271ad801e4ff293887cde324c28d0" },
|
||||
"nvim-dap": { "branch": "master", "commit": "4048f37bc8b1a36fe1f5fde0df7d84aef71380e4" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
||||
"nvim-lint": { "branch": "master", "commit": "962a76877a4479a535b935bd7ef35ad41ba308b2" },
|
||||
|
@ -60,23 +60,23 @@
|
|||
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "696cff781a4a7ecc91549736835e2acbd00fe859" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "78a9ca5ed6557f29cd0ce203df44213e54bfabb9" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "d2fe87062dde25e7fdadac061f6ca04541275e31" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "7e3c0bee7b246ca835d5f7453db6fa19de359bab" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "efec7115d8175bdb6720eeb4e26196032cb52593" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "2806d83e3965017382ce08792ee527e708fa1bd4" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" },
|
||||
"orgmode": { "branch": "master", "commit": "a6fc6b224188c519fa4e9c0beddd5f3b22575d6e" },
|
||||
"orgmode": { "branch": "master", "commit": "47b2978142f5efca723fdf4e372887009259e70b" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "6f462a61ce9a5f47743cbf78454bed14a855eb03" },
|
||||
"pantran.nvim": { "branch": "main", "commit": "461799624948bfb66f73b20b6fffa7e4c8ca6d08" },
|
||||
"parinfer-rust": { "branch": "master", "commit": "0e4d52e712641ad351a1bfe6cee3d34d63ed087b" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "9fda1322e704acfbb5a9691e2c4303368d591367" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "df8cdf68234fbf056202a9684931c3dfa89988c1" },
|
||||
"rest.nvim": { "branch": "main", "commit": "b8d6c0a8762fd374e0204768a94241135ca3e311" },
|
||||
"scope.nvim": { "branch": "main", "commit": "01ce40fe7434fba9a122c01b4734479b3860609a" },
|
||||
"scope.nvim": { "branch": "main", "commit": "cd27af77ad61a7199af5c28d27013fb956eb0e3e" },
|
||||
"sniprun": { "branch": "master", "commit": "0ad935699a5e24ca3a0aa621c7425ac7029775b3" },
|
||||
"ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
|
||||
"stickybuf.nvim": { "branch": "master", "commit": "f3398f8639e903991acdf66e2d63de7a78fe708e" },
|
||||
|
@ -90,7 +90,7 @@
|
|||
"treesj": { "branch": "main", "commit": "070e6761d0b11a55446d988a69908f7a0928dbab" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
|
||||
"undotree": { "branch": "master", "commit": "3ff3aa02fd3a18d7fc5be9ed3166d36c545707fe" },
|
||||
"undotree": { "branch": "master", "commit": "170aa9e516b6926e6bddfe21bbf01f2283a00e7d" },
|
||||
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
|
||||
"vim-log-highlighting": { "branch": "master", "commit": "1037e26f3120e6a6a2c0c33b14a84336dee2a78f" },
|
||||
"vim-matchup": { "branch": "master", "commit": "6dbe108230c7dbbf00555b7d4d9f6a891837ef07" },
|
||||
|
|
|
@ -118,6 +118,12 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
zls = {
|
||||
settings = {
|
||||
warn_style = true,
|
||||
highlight_global_var_declarations = true,
|
||||
},
|
||||
},
|
||||
jsonls = {
|
||||
cmd = { servers_path .. '/vscode/node_modules/.bin/vscode-json-language-server', '--stdio' },
|
||||
-- Schema catalog: https://www.schemastore.org/api/json/catalog.json
|
||||
|
@ -222,5 +228,4 @@ return {
|
|||
taplo = {},
|
||||
terraformls = {},
|
||||
typst_lsp = {},
|
||||
zls = {},
|
||||
}
|
||||
|
|
|
@ -16,9 +16,6 @@ return {
|
|||
},
|
||||
},
|
||||
update_focused_file = { enable = true, update_root = true },
|
||||
system_open = {
|
||||
cmd = vim.loop.os_uname().sysname == 'Darwin' and 'open' or 'xdg-open',
|
||||
},
|
||||
filters = {
|
||||
custom = {
|
||||
'^\\.bzr$',
|
||||
|
|
|
@ -308,7 +308,6 @@ return {
|
|||
},
|
||||
},
|
||||
opts = {
|
||||
mkdp_browser = vim.loop.os_uname().sysname == 'Darwin' and 'open' or 'xdg-open',
|
||||
mkdp_refresh_slow = 1,
|
||||
mkdp_filetypes = { 'markdown', 'rmd' },
|
||||
mkdp_echo_preview_url = 0,
|
||||
|
|
227
magefile.go
227
magefile.go
|
@ -3,27 +3,34 @@
|
|||
|
||||
package main
|
||||
|
||||
// NOTE: intentionally not handle errors (and just log.Fatal everywhere) to have nice terminal output.
|
||||
// (output received errors via logrus instead of mage)
|
||||
// NOTE: intentionally not handle errors with mage to have nice terminal output via logrus
|
||||
// TODO: run commands with sh.Run instead of exec.Command (when https://github.com/magefile/mage/issues/213 is fixed)
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"sync"
|
||||
"strings"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
yaml "github.com/goccy/go-yaml"
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/magefile/mage/mg"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"mvdan.cc/sh/v3/expand"
|
||||
"mvdan.cc/sh/v3/interp"
|
||||
"mvdan.cc/sh/v3/syntax"
|
||||
)
|
||||
|
||||
type Target struct {
|
||||
Type string `yaml:"type" validate:"required,oneof=python nodejs"`
|
||||
Category string `yaml:"category" validate:"required,oneof=lsp dap lint"`
|
||||
Pkgs []string `yaml:"pkgs,omitempty" validate:"omitempty,min=1,dive,min=1"`
|
||||
Env map[string]string `yaml:"env,omitempty" validate:"excluded_unless=Type custom,omitempty,min=1,dive,keys,min=1,endkeys,required"`
|
||||
Type string `yaml:"type" validate:"required,oneof=python nodejs custom"`
|
||||
Category string `yaml:"category" validate:"required,oneof=lsp dap lint"`
|
||||
Pkgs []string `yaml:"pkgs,omitempty" validate:"excluded_if=Type custom,omitempty,min=1,dive,min=1"`
|
||||
Script []string `yaml:"script,omitempty" validate:"required_if=Type custom,omitempty,min=1,dive,min=1"`
|
||||
}
|
||||
|
||||
type Install mg.Namespace
|
||||
|
@ -41,24 +48,23 @@ var Aliases = map[string]any{
|
|||
}
|
||||
|
||||
var (
|
||||
inputFile = "pkgs.yaml"
|
||||
validate = validator.New()
|
||||
validate = validator.New()
|
||||
targets, readErr = readTargets("pkgs.yaml")
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
DisableTimestamp: true,
|
||||
DisableQuote: true,
|
||||
})
|
||||
log.SetOutput(os.Stderr)
|
||||
log.SetLevel(log.InfoLevel)
|
||||
logrus.SetOutput(os.Stderr)
|
||||
logrus.SetLevel(logrus.InfoLevel)
|
||||
}
|
||||
|
||||
// List lists installable targets
|
||||
func List() {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
// Categorize the list
|
||||
|
@ -97,106 +103,61 @@ func List() {
|
|||
|
||||
// Pkg installs the specified target
|
||||
func (Install) Pkg(target string) {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
install(targets, target)
|
||||
if err := install(targets, target); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Lsp installs all LSP servers
|
||||
func (Install) Lsp() {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
log.Warn("Installing LSP servers")
|
||||
|
||||
filterdTargets := filterTargets(targets, "lsp")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(filterdTargets))
|
||||
|
||||
for target := range filterdTargets {
|
||||
go func(t string) {
|
||||
defer wg.Done()
|
||||
install(filterdTargets, t)
|
||||
}(target)
|
||||
logrus.Warn("Installing LSP servers")
|
||||
if err := installGroup(filterTargets(targets, "lsp")); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// Dap installs all DAP servers
|
||||
func (Install) Dap() {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
log.Warn("Installing DAP servers")
|
||||
|
||||
filterdTargets := filterTargets(targets, "dap")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(filterdTargets))
|
||||
|
||||
for target := range filterdTargets {
|
||||
go func(t string) {
|
||||
defer wg.Done()
|
||||
install(filterdTargets, t)
|
||||
}(target)
|
||||
logrus.Warn("Installing DAP servers")
|
||||
if err := installGroup(filterTargets(targets, "dap")); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// Linters installs all linters and formatters
|
||||
func (Install) Linters() {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
log.Warn("Installing linters and formatters")
|
||||
|
||||
filterdTargets := filterTargets(targets, "lint")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(filterdTargets))
|
||||
|
||||
for target := range filterdTargets {
|
||||
go func(t string) {
|
||||
defer wg.Done()
|
||||
install(filterdTargets, t)
|
||||
}(target)
|
||||
logrus.Warn("Installing linters and formatters")
|
||||
if err := installGroup(filterTargets(targets, "lint")); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// All installs everything
|
||||
func (Install) All() {
|
||||
targets, err := readTargets(inputFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if readErr != nil {
|
||||
logrus.Fatal(readErr)
|
||||
}
|
||||
|
||||
log.Warn("Installing everything")
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(targets))
|
||||
|
||||
for target := range targets {
|
||||
go func(t string) {
|
||||
defer wg.Done()
|
||||
install(targets, t)
|
||||
}(target)
|
||||
logrus.Warn("Installing everything")
|
||||
if err := installGroup(targets); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// readTargets returns the list of installable targets from YAML input file
|
||||
|
@ -234,42 +195,55 @@ func filterTargets(targets map[string]Target, category string) map[string]Target
|
|||
return result
|
||||
}
|
||||
|
||||
// install installs the specified target if it existed inside the provided target list
|
||||
func install(targets map[string]Target, target string) {
|
||||
targetLog := log.WithField("target", target)
|
||||
// installGroup installs the provided list of targets concurrently
|
||||
func installGroup(targets map[string]Target) error {
|
||||
errGroup := new(errgroup.Group)
|
||||
|
||||
for target := range targets {
|
||||
t := target
|
||||
errGroup.Go(func() error {
|
||||
return install(targets, t)
|
||||
})
|
||||
}
|
||||
|
||||
return errGroup.Wait()
|
||||
}
|
||||
|
||||
// install installs the specified target if it exists inside the provided target list
|
||||
func install(targets map[string]Target, target string) error {
|
||||
targetLog := logrus.WithField("target", target)
|
||||
|
||||
spec, ok := targets[target]
|
||||
if !ok {
|
||||
targetLog.Fatal("invalid target")
|
||||
return fmt.Errorf("invalid target '%s'", target)
|
||||
}
|
||||
|
||||
targetLog.Warn("Installing target")
|
||||
|
||||
// Create the parent directory
|
||||
data_dir, ok := os.LookupEnv("XDG_DATA_HOME")
|
||||
if !ok {
|
||||
data_dir = filepath.Join(os.Getenv("HOME"), ".local", "share")
|
||||
}
|
||||
install_dir := filepath.Join(data_dir, "nvim", spec.Category, target)
|
||||
err := os.MkdirAll(install_dir, 0o755)
|
||||
if err != nil {
|
||||
targetLog.Fatal(err)
|
||||
}
|
||||
|
||||
// Use the target's name as its package name, if not specified
|
||||
if len(spec.Pkgs) == 0 {
|
||||
spec.Pkgs = append(spec.Pkgs, target)
|
||||
// Create the parent directory to install packages into (in the case of `python` or `nodejs`).
|
||||
// For `custom` type, the script should make this directory in its own way
|
||||
if spec.Type == "nodejs" || spec.Type == "python" {
|
||||
err := os.MkdirAll(install_dir, 0o755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Use the target's name as its package name, if not specified
|
||||
if len(spec.Pkgs) == 0 {
|
||||
spec.Pkgs = append(spec.Pkgs, target)
|
||||
}
|
||||
}
|
||||
|
||||
switch spec.Type {
|
||||
case "nodejs":
|
||||
pnpm, err := exec.LookPath("pnpm")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, pkg := range spec.Pkgs {
|
||||
cmd := [3]string{pnpm, "add", fmt.Sprintf("%s@latest", pkg)}
|
||||
cmd := [3]string{"pnpm", "add", fmt.Sprintf("%s@latest", pkg)}
|
||||
targetLog.Infof("%s %s %s", cmd[0], cmd[1], cmd[2])
|
||||
|
||||
execCmd := exec.Command(cmd[0], cmd[1:]...)
|
||||
|
@ -277,24 +251,20 @@ func install(targets map[string]Target, target string) {
|
|||
execCmd.Stdout = os.Stdout
|
||||
execCmd.Stderr = os.Stderr
|
||||
if err := execCmd.Run(); err != nil {
|
||||
targetLog.Fatalf("failed to install %s: %v", pkg, err)
|
||||
return fmt.Errorf("failed to install %s: %v", pkg, err)
|
||||
}
|
||||
}
|
||||
case "python":
|
||||
python, err := exec.LookPath("python3")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
case "python":
|
||||
// Always upgrade pip along the way
|
||||
spec.Pkgs = append(spec.Pkgs, "pip")
|
||||
|
||||
// Create a venv directory to install the target's packages into
|
||||
execCmd := exec.Command(python, "-m", "venv", install_dir)
|
||||
execCmd := exec.Command("python3", "-m", "venv", install_dir)
|
||||
execCmd.Stdout = os.Stdout
|
||||
execCmd.Stderr = os.Stderr
|
||||
if err := execCmd.Run(); err != nil {
|
||||
targetLog.Fatalf("failed to create venv: %v", err)
|
||||
return fmt.Errorf("failed to create venv: %v", err)
|
||||
}
|
||||
|
||||
for _, pkg := range spec.Pkgs {
|
||||
|
@ -306,8 +276,39 @@ func install(targets map[string]Target, target string) {
|
|||
execCmd.Stdout = os.Stdout
|
||||
execCmd.Stderr = os.Stderr
|
||||
if err := execCmd.Run(); err != nil {
|
||||
targetLog.Fatalf("failed to install %s: %v", pkg, err)
|
||||
return fmt.Errorf("failed to install %s: %v", pkg, err)
|
||||
}
|
||||
}
|
||||
|
||||
case "custom":
|
||||
// Always export `PKG_INSTALL_DIR` for convenient usage in script block.
|
||||
// Also inherit from the shell env, to have proper PATH and so on.
|
||||
envs := append(os.Environ(), "PKG_INSTALL_DIR="+install_dir)
|
||||
for k, v := range spec.Env {
|
||||
envs = append(envs, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
|
||||
runner, err := interp.New(
|
||||
interp.Env(expand.ListEnviron(envs...)),
|
||||
interp.StdIO(nil, os.Stdout, os.Stderr),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx := context.TODO() // just create a dummy context for each custom target
|
||||
for _, line := range spec.Script {
|
||||
targetLog.Info(line)
|
||||
script, err := syntax.NewParser().Parse(strings.NewReader(line), "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = runner.Run(ctx, script)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
22
pkgs.yaml
22
pkgs.yaml
|
@ -24,10 +24,32 @@ dockerls:
|
|||
<<: *nodejs_lsp
|
||||
pkgs: [dockerfile-language-server-nodejs]
|
||||
|
||||
# NOTE: elixirls also supports DAP, but keep it in `lsp` category
|
||||
elixirls:
|
||||
category: lsp
|
||||
type: custom
|
||||
env:
|
||||
MIX_ENV: prod
|
||||
script:
|
||||
- |
|
||||
if [ -d "$PKG_INSTALL_DIR" ]; then
|
||||
git -C "$PKG_INSTALL_DIR" pull origin master
|
||||
else
|
||||
git clone --depth 1 --single-branch https://github.com/elixir-lsp/elixir-ls.git "$PKG_INSTALL_DIR"
|
||||
fi
|
||||
- cd "$PKG_INSTALL_DIR"
|
||||
- mix deps.get
|
||||
- mix compile
|
||||
- mix elixir_ls.release2 -o release/
|
||||
|
||||
emmet_language_server:
|
||||
<<: *nodejs_lsp
|
||||
pkgs: ['@olrtg/emmet-language-server']
|
||||
|
||||
mdx_analyzer:
|
||||
<<: *nodejs_lsp
|
||||
pkgs: ['@mdx-js/language-server']
|
||||
|
||||
pylsp:
|
||||
category: lsp
|
||||
type: python
|
||||
|
|
Loading…
Reference in a new issue