Various improvements that I'm too lazy to list :)

This commit is contained in:
Hoang Nguyen 2023-12-24 00:00:00 +07:00
parent 2912c6f350
commit 054dfe9152
Signed by: folliehiyuki
GPG Key ID: B0567C20730E9B11
27 changed files with 475 additions and 302 deletions

30
.luarc.json Normal file
View File

@ -0,0 +1,30 @@
{
"completion.autoRequire": false,
"diagnostics.globals": [
"vim"
],
"workspace.library": [
"$HOME/.local/share/nvim/lazy/emmylua-nvim",
"$HOME/.local/share/nvim/lazy/conform.nvim",
"$HOME/.local/share/nvim/lazy/heirline.nvim",
"$HOME/.local/share/nvim/lazy/lazy.nvim",
"$HOME/.local/share/nvim/lazy/nvim-cmp",
"$HOME/.local/share/nvim/lazy/nvim-cokeline",
"$HOME/.local/share/nvim/lazy/nvim-dap",
"$HOME/.local/share/nvim/lazy/nvim-lint",
"$HOME/.local/share/nvim/lazy/nvim-notify",
"$HOME/.local/share/nvim/lazy/nvim-tree.lua",
"$HOME/.local/share/nvim/lazy/overseer.nvim",
"$HOME/.local/share/nvim/lazy/plenary.nvim",
"/usr/share/nvim/runtime/lua",
"{3rd}/luv/library"
],
"runtime": {
"version": "LuaJIT",
"path": [
"lua/?.lua",
"lua/?/init.lua"
]
},
"telemetry.enable": false
}

View File

@ -20,16 +20,13 @@ This Neovim config used to live within [my dotfiles](/FollieHiyuki/dotfiles-ansi
### Additional DAP/LSP servers
- elixirls/lexical, elp/erlangls (config for `nvim-lspconfig` and `nvim-dap`)
- elixirls/lexical, elp/erlangls (config for `nvim-lspconfig`)
- remark-language-server
- swift-MesonLSP (inside container)
- mdx_analyzer
- ocamllsp
- graphql
- glint (for handlebars files)
- vscode-js-debug (config for `nvim-dap` + install script)
- eslint (LSP) (maybe biome is already good enough???)
- lldb-vscode (`nvim-dap` config for C/C++/Zig)
- one-small-step-for-vimkind
- cmake-language-server / neocmakelsp
- dart/flutter (flutter-tools.nvim / configure dartls directly) (ref: <https://gist.github.com/christopherfujino/80be0f4cd88f75c4991b478e6b071153>)
@ -56,18 +53,18 @@ This Neovim config used to live within [my dotfiles](/FollieHiyuki/dotfiles-ansi
- venv-selector.nvim
- virtual-types.nvim
- hover.nvim
- flatten.nvim
- nvim-dap-repl-highlights
- nvim-tree.lua -> neo-tree???
### Logic
- Smooth colorschemes changing (dynamic highlight groups registration via event hooks)
- User commands/bindings per LSP server
## FAQ
### Why not using [mason.nvim](https://github.com/williamboman/mason.nvim)?
Most things installed via **mason.nvim** are in binary format, which might be incompatible to run on the Linux distribution I use - [AlpineLinux](https://alpinelinux.org). I resolved to custom [mage](https://magefile.org) tasks instead. The [tasks' source code](./magefile.go) is pretty simple and naive, but it works for me.
Most things installed via **mason.nvim** are binaries linked to glibc, which are incompatible to run on the Linux distribution I use - [AlpineLinux](https://alpinelinux.org). I resolved to custom [mage](https://magefile.org) tasks instead. The [tasks' source code](./magefile.go) is pretty simple and naive, but it works for me.
External LSP servers that can't be installed directly from AlpineLinux's repositories, or with simple `cargo/go install` commands, are defined inside [pkgs.yaml](./pkgs.yaml) file.

View File

@ -1 +1 @@
/home/follie/.config/nvim/after/ftplugin/go.lua
go.lua

View File

@ -1 +1 @@
/home/follie/.config/nvim/after/ftplugin/asciidoc.lua
asciidoc.lua

View File

@ -1,12 +0,0 @@
local o = vim.opt_local
o.wrap = true
o.number = false
o.relativenumber = false
-- Preview file at cursor with TexLab LSP command
vim.keymap.set('n', '<localleader>p', '<cmd>TexlabForward<CR>', {
buffer = true,
noremap = true,
silent = true,
desc = 'Preview LaTEX file',
})

1
after/ftplugin/tex.lua Symbolic link
View File

@ -0,0 +1 @@
asciidoc.lua

2
go.mod
View File

@ -7,7 +7,7 @@ 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
golang.org/x/sync v0.5.0
mvdan.cc/sh/v3 v3.7.0
)

4
go.sum
View File

@ -44,8 +44,8 @@ golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY=
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
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/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
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=

View File

@ -1,99 +1,99 @@
{
"LuaSnip": { "branch": "master", "commit": "1def35377854535bb3b0f4cc7a33c083cdb12571" },
"SchemaStore.nvim": { "branch": "main", "commit": "5bfeb36550018438c2c7ef58f91174f79d99a28a" },
"aerial.nvim": { "branch": "master", "commit": "88764566f96bf900a64b3dcd6d178cfb69b1c8ce" },
"LuaSnip": { "branch": "master", "commit": "57c9f5c31b3d712376c704673eac8e948c82e9c1" },
"SchemaStore.nvim": { "branch": "main", "commit": "771c9517bf36f431361cbaac1ddc8499c7e5c5d3" },
"aerial.nvim": { "branch": "master", "commit": "e2e3bc2df4490690ea005395eecdc8eeb30c4def" },
"alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" },
"better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
"carbon-now.nvim": { "branch": "main", "commit": "16e843489ba00493466170919abfe144fc9aa158" },
"ccc.nvim": { "branch": "main", "commit": "f77b477d9f0b9a28612212b3fc43145f2a5591cc" },
"ccc.nvim": { "branch": "main", "commit": "ec6e23fd2c0bf4ffcf71c1271acdcee6e2c6f49c" },
"cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-dap": { "branch": "master", "commit": "d16f14a210cd28988b97ca8339d504533b7e09a4" },
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
"cmp-fish": { "branch": "main", "commit": "8ae7bfb1b3251d433c4adf4e64396ef929fbd91f" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "e8ac7f1a9a3973ecce6942b2f26d16e65902aa70" },
"conform.nvim": { "branch": "master", "commit": "41852493b5abd7b5a0fd61ff007994c777a08ec9" },
"dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" },
"emmylua-nvim": { "branch": "master", "commit": "ac5fbc9e5f528d59d6f1e9f6732eb8f21002715b" },
"emmylua-nvim": { "branch": "master", "commit": "a7144617e9c42948f7e8a13803b3007820590798" },
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"git-conflict.nvim": { "branch": "main", "commit": "896261933afe2fddf6fb043d9cd4d88301b151a9" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" },
"headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" },
"heirline.nvim": { "branch": "master", "commit": "170e1b1fd7c11db00e46d802165fb277db601ae7" },
"inc-rename.nvim": { "branch": "main", "commit": "14922a84777702244a499b43134b9d04e640cbcd" },
"indent-blankline.nvim": { "branch": "master", "commit": "dbd90bb689ff10d21fee6792eb8928f0584b5860" },
"inc-rename.nvim": { "branch": "main", "commit": "e346532860e1896b1085815e854ed14e2f066a2c" },
"indent-blankline.nvim": { "branch": "master", "commit": "0dca9284bce128e60da18693d92999968d6cb523" },
"iswap.nvim": { "branch": "master", "commit": "6b77e8a2235aebbc6d2df150d0c780200f0cefa2" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mini.ai": { "branch": "main", "commit": "4a2e387b121352dfb478f440c9a5313a9d97006c" },
"mini.align": { "branch": "main", "commit": "c5ab28809c630b65ffe069b564ce1d473bbcb332" },
"mini.animate": { "branch": "main", "commit": "626c51eba5d344572d6da0938044a73369de8b8b" },
"mini.bufremove": { "branch": "main", "commit": "f53c7f27e36009fe61563c11cde154b94a0e5b94" },
"mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" },
"mini.move": { "branch": "main", "commit": "b3bca8e493f8d1da343ff1be06c21a47e2fde1c0" },
"mini.pairs": { "branch": "main", "commit": "71f117fd57f930da6ef4126b24f594dd398bac26" },
"mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" },
"mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" },
"mini.align": { "branch": "main", "commit": "708c0265b1513a00c83c181bff3d237741031cd1" },
"mini.animate": { "branch": "main", "commit": "6cec625114007527ff8a82316dba858046f9746f" },
"mini.bufremove": { "branch": "main", "commit": "020243bfed8c8b941f2c20626faf3ea39c0c0e1b" },
"mini.comment": { "branch": "main", "commit": "67f00d3ebbeae15e84584d971d0c32aad4f4f3a4" },
"mini.move": { "branch": "main", "commit": "03a16d64e58da0a871de6493c3d8fa1101baef46" },
"mini.pairs": { "branch": "main", "commit": "552062017ff207e1f35f7028bfb3f27c7421d22d" },
"mini.surround": { "branch": "main", "commit": "7bf8915ba15d7a4f3c2afe7868d3c15a858d73f1" },
"neoconf.nvim": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" },
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
"neogit": { "branch": "master", "commit": "d0e87541130b2cf62d7f8a54487ef99560232fb6" },
"neotest": { "branch": "master", "commit": "d424d262d01bccc1e0b038c9a7220a755afd2a1f" },
"neogit": { "branch": "master", "commit": "470c11dd033de871380a8c5da835d6b691b2d0c6" },
"neotest": { "branch": "master", "commit": "6aa6e4529a4a125b49c48541b97ba146ceee2441" },
"neotest-go": { "branch": "main", "commit": "d29d20d912aca81a07c50022d880cc66f0d26542" },
"neotest-jest": { "branch": "main", "commit": "d8b00a91e440474da20a8e9acdb0d72051078b8b" },
"neotest-python": { "branch": "master", "commit": "c969a5b0073f2b5c8eaf017d1652f9251d761a15" },
"neotest-vitest": { "branch": "main", "commit": "41bf2f6b743f2ac5c5e9bd0949cee77ca7f2372c" },
"neotest-zig": { "branch": "main", "commit": "91741a61647d5373cc314a3d0c29856899da1169" },
"neotest-jest": { "branch": "main", "commit": "a394106cf053eef86d65ae04c4b93a1a7bd60aef" },
"neotest-python": { "branch": "master", "commit": "86ac2bbc8a4da3f203e56d9303d6ed1d7e50c1f6" },
"neotest-vitest": { "branch": "main", "commit": "15972c4791b3d47df82311047835803a072c1da6" },
"neotest-zig": { "branch": "main", "commit": "742f97f971a39d44b4832b432083608834a0e59c" },
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
"nui.nvim": { "branch": "main", "commit": "257dccc43b4badc735978f0791d216f7d665b75a" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-cokeline": { "branch": "main", "commit": "2e71292a37535fdbcf0f9500aeb141021d90af8b" },
"nvim-coverage": { "branch": "main", "commit": "13e357d4a2a230070c64ede61252225f0b7d3b5e" },
"nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" },
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-cokeline": { "branch": "main", "commit": "07069496c3a25c3d9956292d05008ca17036afe0" },
"nvim-coverage": { "branch": "main", "commit": "cf4b5c61dfac977026a51a2bcad9173c272986ce" },
"nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
"nvim-lint": { "branch": "master", "commit": "6f589cb93560581dc2a3b9693658afe865e5649e" },
"nvim-lspconfig": { "branch": "master", "commit": "694aaec65733e2d54d393abf80e526f86726c988" },
"nvim-lint": { "branch": "master", "commit": "32f98300881f38f4e022391f240188fec42f74db" },
"nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-notify": { "branch": "master", "commit": "27a6649ba6b22828ccc67c913f95a5407a2d8bec" },
"nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" },
"nvim-spectre": { "branch": "master", "commit": "a18a58015b46f02b4fe537ebfffd82e46110ff24" },
"nvim-tree.lua": { "branch": "master", "commit": "05f55c1fd6470b31627655c528245794e3cd4b2c" },
"nvim-treesitter": { "branch": "master", "commit": "80a16deb5146a3eb4648effccda1ab9f45e43e76" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" },
"nvim-tree.lua": { "branch": "master", "commit": "50f30bcd8c62ac4a83d133d738f268279f2c2ce2" },
"nvim-treesitter": { "branch": "master", "commit": "cd4de5f7b14b878ac8f5c459c9d579cc58ba1ac5" },
"nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "4795812635c7b90cec41637314862b0a229d2b24" },
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },
"orgmode": { "branch": "master", "commit": "cbb10d4c7514680e90f791d62f1168cb87aad0ce" },
"overseer.nvim": { "branch": "master", "commit": "6f462a61ce9a5f47743cbf78454bed14a855eb03" },
"nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" },
"orgmode": { "branch": "master", "commit": "92bfc3fb7ee845d9e58326b0b69f3ed89e84253f" },
"overseer.nvim": { "branch": "master", "commit": "8e701da79f3fd7c44c3e8ad1aed6512aedc50191" },
"pantran.nvim": { "branch": "main", "commit": "461799624948bfb66f73b20b6fffa7e4c8ca6d08" },
"parinfer-rust": { "branch": "master", "commit": "0e4d52e712641ad351a1bfe6cee3d34d63ed087b" },
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "47404636a34580db1636dc0cf35027bdf77abba5" },
"rest.nvim": { "branch": "main", "commit": "45b52200b4a7712a68579d9d13945427e2764725" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "35413f67fb918207a4acc4948ca9ccb75b6cf8d5" },
"rest.nvim": { "branch": "main", "commit": "84e81a19ab24ccf05c9233d34d4dfce61c233abe" },
"scope.nvim": { "branch": "main", "commit": "cd27af77ad61a7199af5c28d27013fb956eb0e3e" },
"sniprun": { "branch": "master", "commit": "7a8bc30fcf04fd4efec43be368f12eb4266fabf6" },
"sniprun": { "branch": "master", "commit": "639877399a23e375a8c07b75c14d017735eab7cb" },
"ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
"stickybuf.nvim": { "branch": "master", "commit": "4271bfc6c85dc035eb9e8484954f9179d90e87ab" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "d7c453396a043c265bef1227920628e7b811ff30" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "8e0543365fe5781c9babea7db89ef06bcff3716d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
"telescope-tabs": { "branch": "master", "commit": "a38c8fee471257a0ff233e065c4a0d123f8e67b0" },
"telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" },
"telescope.nvim": { "branch": "master", "commit": "f336f8cfab38a82f9f00df380d28f0c2a572f862" },
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
"toggleterm.nvim": { "branch": "main", "commit": "6b334b9d1266b0f58ab1b6965c1e5b7eb5c34523" },
"toggleterm.nvim": { "branch": "main", "commit": "91be5f327e42aa016da13b277540de8dba0b14e3" },
"treesj": { "branch": "main", "commit": "1d6e89f4790aa04eaae38fa9460a3ee191961c96" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
"venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
"vim-log-highlighting": { "branch": "master", "commit": "1037e26f3120e6a6a2c0c33b14a84336dee2a78f" },
"vim-matchup": { "branch": "master", "commit": "269f9bea87e20a01438085eb13df539929a12727" },
"vim-matchup": { "branch": "master", "commit": "2550178c43464134ce65328da458905f70dbe041" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },

View File

@ -49,7 +49,6 @@ end
-- toggle LSP settings
map('n', '<leader>ud', require('user.plugins.lsp.lspconfig.diagnostic').toggle, { desc = 'Toggle diagnostics' })
map('n', '<leader>uv', require('user.plugins.lsp.lspconfig.diagnostic').toggle_virtual_lines, { desc = 'Toggle virtual lines diagnostics' })
map('n', '<leader>uf', require('user.plugins.lsp.lspconfig.format').toggle, { desc = 'Toggle format on save' })
if vim.lsp.inlay_hint then
map('n', '<leader>uy', function() vim.lsp.inlay_hint(0, nil) end, { desc = 'Toggle inlay hints' })
end

View File

@ -8,7 +8,7 @@ local sources_config = {
luasnip = { item_menu = 'SNIP' },
nvim_lsp = { item_menu = 'LSP' },
orgmode = { item_menu = 'ORG' },
path = { item_menu = 'PATH' },
async_path = { item_menu = 'PATH' },
}
local sources = vim.deepcopy(sources_config)
@ -48,7 +48,7 @@ cmp.setup {
format = function(entry, vim_item)
vim_item.menu = sources_config[entry.source.name].item_menu
if vim.tbl_contains({ 'path' }, entry.source.name) then
if vim.tbl_contains({ 'async_path' }, entry.source.name) then
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
if icon then
vim_item.kind = icon
@ -117,7 +117,7 @@ cmp.setup {
sources.nvim_lsp,
sources.buffer,
sources.luasnip,
sources.path,
sources.async_path,
},
}
@ -126,7 +126,7 @@ cmp.setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, {
sources = { sources.dap, sources.buffer },
})
cmp.setup.filetype('fish', {
sources = { sources.fish, sources.buffer, sources.path },
sources = { sources.fish, sources.buffer, sources.async_path },
})
cmp.setup.filetype('org', {
sources = cmp.config.sources {
@ -134,6 +134,6 @@ cmp.setup.filetype('org', {
sources.nvim_lsp,
sources.luasnip,
sources.buffer,
sources.path,
sources.async_path,
},
})

View File

@ -6,7 +6,7 @@ return {
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'FelipeLema/cmp-async-path',
'hrsh7th/cmp-nvim-lsp',
'saadparwaiz1/cmp_luasnip',
{

View File

@ -4,44 +4,6 @@ local lazy_util = require('lazy.core.util')
-- Default port to attach to an existing Delve instance
local delve_port = 38697
local get_arguments = function()
local co = coroutine.running()
local args = {}
if co then
return coroutine.create(function()
vim.ui.input({ prompt = 'Args: ' }, function(input)
args = vim.split(input or '', ' ')
end)
coroutine.resume(co, args)
end)
end
vim.ui.input({ prompt = 'Args: ' }, function(input)
args = vim.split(input or '', ' ')
end)
return args
end
local get_connection = function()
local co = coroutine.running()
local response = {}
if co then
return coroutine.create(function()
vim.ui.input({ prompt = 'Connection: ' }, function(input)
response = vim.split(input or ('127.0.0.1:' .. delve_port), ':')
end)
coroutine.resume(co, { host = response[1], port = response[2] or delve_port })
end)
end
vim.ui.input({ prompt = 'Connection: ' }, function(input)
response = vim.split(input or ('127.0.0.1:' .. delve_port), ':')
end)
return { host = response[1], port = response[2] or delve_port }
end
-- https://github.com/ray-x/go.nvim/blob/master/lua/go/dap.lua
dap.adapters.go = function(callback, config)
local host = (config.connect or config).host or '127.0.0.1'
@ -65,7 +27,9 @@ dap.adapters.go = function(callback, config)
local function on_read(err, chunk)
assert(not err, err)
if not chunk or chunk == '' then return end
if not chunk or chunk == '' then
return
end
if chunk:find("couldn't start") then
vim.schedule(function()
@ -120,7 +84,13 @@ dap.configurations.go = {
mode = 'remote',
type = 'go',
request = 'attach',
connect = get_connection,
connect = function()
local response = {}
vim.ui.input({ prompt = 'Connection: ' }, function(input)
response = vim.split(input or ('127.0.0.1:' .. delve_port), ':')
end)
return { host = response[1], port = response[2] or delve_port }
end,
},
{
name = 'Debug',
@ -133,7 +103,13 @@ dap.configurations.go = {
type = 'go',
request = 'launch',
program = '${file}',
args = get_arguments,
args = function()
local args = {}
vim.ui.input({ prompt = 'Args: ' }, function(input)
args = vim.split(input or '', ' ')
end)
return args
end,
},
{
name = 'Debug test',

View File

@ -0,0 +1,29 @@
local dap = require('dap')
dap.adapters.mix_task = {
type = 'executable',
command = vim.fn.stdpath('data') .. '/lsp/elixirls/scripts/debug_adapter.sh',
}
dap.configurations.elixir = {
{
type = 'mix_task',
name = 'mix test',
request = 'launch',
task = 'test',
taskArgs = { '--trace' },
startApps = true,
projectDir = '${workspaceFolder}',
requireFiles = {
'test/**/test_helper.exs',
'test/**/*_test.exs',
},
},
{
type = 'mix_task',
name = 'phoenix',
request = 'launch',
task = 'phx.server',
projectDir = '${workspaceFolder}',
}
}

View File

@ -10,8 +10,9 @@ for name, sign in pairs(vars.icons.dap) do
})
end
require('user.plugins.debugger.dap.dlv')
require('user.plugins.debugger.dap.debugpy')
for _, mod in ipairs { 'dlv', 'debugpy', 'lldb', 'elixir' } do
require('user.plugins.debugger.dap.' .. mod)
end
-- Use overseer's JSON decoder
require('dap.ext.vscode').json_decode = require('overseer.json').decode

View File

@ -0,0 +1,44 @@
local dap = require('dap')
local ask_for_args = function()
local args = {}
vim.ui.input({ prompt = 'Args: ' }, function(input)
args = vim.split(input or '', ' ')
end)
return args
end
local ask_for_executable = function()
local exec_location = ''
vim.ui.input({
prompt = 'Path to executable: ',
default = vim.fn.getcwd() .. '/',
completion = 'file',
}, function(input)
if input then
exec_location = input
end
end)
return exec_location
end
dap.adapters.lldb = {
name = 'lldb',
type = 'executable',
command = '/usr/bin/lldb-vscode', -- NOTE: will change to `lldb-dap` in future llvm releases
}
dap.configurations.zig = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = ask_for_executable,
args = ask_for_args,
cwd = '${workspaceFolder}',
stopOnEntry = false,
},
}
dap.configurations.c = dap.configurations.zig
dap.configurations.cpp = dap.configurations.zig

View File

@ -87,7 +87,7 @@ return {
'rescript',
'glimmer',
'astro',
'html.handlebars',
'handlebars',
},
opts = {
filetypes = {

View File

@ -1,12 +1,38 @@
local linters_path = vim.fn.stdpath('data') .. '/lint'
local vars = require('user.config.vars')
local util = require('user.util.misc')
local linters_path = vim.fn.stdpath('data') .. '/lint'
return {
buf = { filetypes = 'proto' },
fish_indent = { filetypes = 'fish' },
-- goimports = { filetypes = 'go', condition = util.root_has_file({ '.git', 'go.mod', 'go.work' }) },
shfmt = { filetypes = 'sh' },
sql_formatter = { filetypes = 'sql', cmd = linters_path .. '/sql_formatter/node_modules/.bin/sql-formatter' },
stylua = { filetypes = 'lua', condition = util.root_has_file({ 'stylua.toml', '.stylua.toml' }) },
yamlfmt = { filetypes = { 'yaml', 'yaml.ansible' } },
log_level = vars.loglevel,
notify_on_error = true,
format_on_save = function()
if not vars.lsp_format_on_save then
return
end
return { timeout_ms = 500, lsp_fallback = true }
end,
formatters_by_ft = {
proto = { 'buf' },
fish = { 'fish_indent' },
go = { 'goimports', 'gofumpt' },
sh = { 'shfmt' },
sql = { 'sql_formatter' },
-- yaml = { 'yamlfmt' },
-- ['yaml.ansible'] = { 'yamlfmt' },
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
-- ['*'] = { 'codespell' },
},
formatters = {
codespell = { command = linters_path .. '/codespell/bin/codespell' },
goimports = {
cwd = function()
return util.root_has_file { '.git', 'go.mod', 'go.work' }
end,
require_cwd = true,
},
gofumpt = { args = { '-extra', '$FILENAME' } },
sql_formatter = { command = linters_path .. '/sql_formatter/node_modules/.bin/sql-formatter' },
},
}

View File

@ -1,3 +1,5 @@
local lazy_util = require('lazy.core.util')
return {
{
'neovim/nvim-lspconfig',
@ -20,10 +22,21 @@ return {
{
'mfussenegger/nvim-lint',
event = { 'BufReadPost', 'BufNewFile', 'BufWritePre' },
opts = function() return require('user.plugins.lsp.lint') end,
opts = function()
return require('user.plugins.lsp.lint')
end,
config = function(_, opts)
local lint = require('lint')
for name, linter in pairs(opts.linters) do
if type(linter) == 'table' and type(lint.linters[name]) == 'table' then
lint.linters[name] = vim.tbl_deep_extend('force', lint.linters[name], linter)
else
lint.linters[name] = linter
end
end
lint.linters_by_ft = opts.linters_by_ft
local function debounce(ms, fn)
local timer = vim.loop.new_timer()
return function(...)
@ -35,71 +48,74 @@ return {
end
end
-- Linters are invoked explicitly, so don't need to define `lint.linters_by_ft`
local function try_lint()
local ft = vim.bo.filetype
local names = lint._resolve_linter_by_ft(ft)
local additional_linters = { fallback = {}, global = {} }
for name, conf in pairs(opts) do
local enabled_ft = type(conf.filetypes) == 'table' and conf.filetypes or { conf.filetypes }
if vim.tbl_contains(enabled_ft, ft) then
vim.list_extend(names, { name } or {})
end
-- * and _ is treated like in `conform.nvim` (assume they are defined as the 1st table element)
if enabled_ft[1] == '_' then
vim.list_extend(additional_linters.fallback, { name } or {})
end
if enabled_ft[1] == '*' then
vim.list_extend(additional_linters.global, { name } or {})
end
end
-- Add fallback and global linters
if #names == 0 then
vim.list_extend(names, additional_linters.fallback or {})
end
vim.list_extend(names, additional_linters.global or {})
-- Filter out linters that don't exist or don't match the defined condition
local file = vim.api.nvim_buf_get_name(0)
names = vim.tbl_filter(function(name)
local conf = opts[name]
return conf and not (type(conf) == 'table' and conf.condition and not conf.condition(file))
end, names)
-- Run linters
if #names > 0 then
lint.try_lint(names)
end
end
-- Add custom linter configurations to the plugin's configuration
for name, conf in pairs(opts) do
if type(conf) == 'table' and type(lint.linters[name]) == 'table' then
lint.linters[name] = vim.tbl_deep_extend('force', lint.linters[name], conf)
else
lint.linters[name] = conf
end
-- Remove our custom fields
lint.linters[name].filetypes = nil
lint.linters[name].condition = nil
end
vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufReadPost', 'InsertLeave' }, {
group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }),
callback = debounce(100, try_lint),
callback = debounce(100, function()
local linters = require('user.util.lsp').active_linters(0)
if #linters > 0 then
lint.try_lint(linters)
end
end),
})
-- Like :ConformInfo, but more basic
vim.api.nvim_create_user_command('LinterInfo', function()
local linters = require('user.util.lsp').active_linters(0)
if #linters > 0 then
lazy_util.info('Linters for this buffer:\n' .. table.concat(linters, '\n'), { title = 'nvim-lint' })
else
lazy_util.warn('No linters available for this buffer', { title = 'nvim-lint' })
end
end, {
desc = 'Print the list of active linters',
})
end,
},
{
'stevearc/conform.nvim',
event = 'BufWritePre',
cmd = 'ConformInfo',
keys = {},
opts = function() return require('user.plugins.lsp.conform') end,
keys = {
{
'<leader>lF',
function()
require('conform').format { formatters = { 'injected' } }
end,
mode = { 'n', 'x' },
desc = 'Format injected codeblock',
},
{
'<leader>lf',
function()
require('conform').format { async = true, lsp_fallback = true }
end,
mode = { 'n', 'x' },
desc = 'Format buffer',
},
{
'<leader>uf',
function()
local vars = require('user.config.vars')
vars.lsp_format_on_save = not vars.lsp_format_on_save
if vars.lsp_format_on_save then
lazy_util.info('Enabled format on save', { title = 'Format' })
else
lazy_util.warn('Disabled format on save', { title = 'Format' })
end
end,
mode = 'n',
desc = 'Toggle format on save',
},
},
opts = function()
return require('user.plugins.lsp.conform')
end,
init = function()
vim.o.formatexpr = 'v:lua.require"conform".formatexpr()'
end,
config = function(_, opts)
require('conform').setup(opts)
end,
},
{ 'smjonas/inc-rename.nvim', cmd = 'IncRename', opts = { hl_group = 'IncSearch' } },

View File

@ -1,27 +1,42 @@
local linters_path = vim.fn.stdpath('data') .. '/lint'
local util = require('user.util.misc')
-- `condition` and `filetypes` are custom fields.
-- The other is the same as in `require('lint').linters.<linter_name>`
return {
buf = { filetypes = 'proto' },
buildifier = { filetypes = 'bzl' },
-- codespell = { filetypes = '*', cmd = linters_path .. '/codespell/bin/codespell' },
cspell = {
cmd = linters_path .. '/cspell/node_modules/.bin/cspell',
filetypes = '*',
condition = util.root_has_file({
'.cspell.json',
'cspell.json',
'.cSpell.json',
'cSpell.json',
'cspell.config.json',
}),
-- Use '*' for global linters (enabled on all buffers)
-- and '_' for fallback linters (enabled when nothing else is)
linters_by_ft = {
bzl = { 'buildifier' },
-- dockerfile = { 'hadolint' },
fish = { 'fish' },
lua = { 'selene' },
markdown = {
-- 'proselint',
'vale',
},
-- org = { 'proselint' },
-- asciidoc = { 'proselint' },
proto = { 'buf' },
sql = { 'sqlfluff' },
['*'] = { 'codespell', 'cspell' },
},
-- `condition` is custom fields.
linters = {
codespell = { cmd = linters_path .. '/codespell/bin/codespell' },
cspell = {
cmd = linters_path .. '/cspell/node_modules/.bin/cspell',
condition = util.root_has_file {
'.cspell.json',
'cspell.json',
'.cSpell.json',
'cSpell.json',
'cspell.config.json',
},
},
fish = { args = { '--private', '--no-execute' } },
proselint = { cmd = linters_path .. '/proselint/bin/proselint' },
selene = { condition = util.root_has_file('selene.toml') },
sqlfluff = { cmd = linters_path .. '/sqlfluff/bin/sqlfluff' },
vale = { condition = util.root_has_file('.vale.ini') },
},
fish = { filetypes = 'fish', args = { '--private', '--no-execute' } },
-- hadolint = { filetypes = 'dockerfile' },
-- proselint = { filetypes = { 'markdown', 'asciidoc', 'org' }, cmd = linters_path .. '/proselint/bin/proselint' },
selene = { filetypes = 'lua', condition = util.root_has_file('selene.toml') },
sqlfluff = { filetypes = 'sql', cmd = linters_path .. '/sqlfluff/bin/sqlfluff' },
vale = { filetypes = 'markdown', condition = util.root_has_file('.vale.ini') },
}

View File

@ -1,41 +0,0 @@
local M = {}
local lazy_util = require('lazy.core.util')
local vars = require('user.config.vars')
function M.toggle()
vars.lsp_format_on_save = not vars.lsp_format_on_save
if vars.lsp_format_on_save then
lazy_util.info('Enabled format on save', { title = 'Format' })
else
lazy_util.warn('Disabled format on save', { title = 'Format' })
end
end
function M.format()
local buf = vim.api.nvim_get_current_buf()
vim.lsp.buf.format { async = true, bufnr = buf }
end
function M.on_attach(client, buf)
if
client.config
and client.config.capabilities
and client.config.capabilities.documentFormattingProvider == false
then
return
end
if client.supports_method('textDocument/formatting') then
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('LspFormat', {}),
buffer = buf,
callback = function()
if vars.lsp_format_on_save then
M.format()
end
end,
})
end
end
return M

View File

@ -10,8 +10,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
local buffer = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
-- Formatting + Key bindings
require('user.plugins.lsp.lspconfig.format').on_attach(client, buffer)
-- Key bindings
require('user.plugins.lsp.lspconfig.keymap').on_attach(client, buffer)
-- Symbol context on winbar

View File

@ -3,15 +3,9 @@ local M = {}
M._keys = nil
function M.get()
local format = function()
require('user.plugins.lsp.lspconfig.format').format()
end
if not M._keys then
M._keys = {
{ '<leader>le', vim.diagnostic.open_float, desc = 'Line diagnostic' },
{ '<leader>lf', format, desc = 'Format document', has = 'documentFormatting' },
{ '<leader>lf', format, desc = 'Format range', mode = 'x', has = 'documentRangeFormatting' },
{ '<leader>la', vim.lsp.buf.code_action, desc = 'Code action', mode = { 'n', 'x' }, has = 'codeAction' },
{ '<leader>ll', vim.lsp.codelens.run, desc = 'Codelens action', mode = 'n', has = 'codeLens' },
{ '<leader>ld', '<cmd>Trouble document_diagnostics<CR>', desc = 'Document diagnostics' },
@ -24,7 +18,7 @@ function M.get()
{ 'gy', '<cmd>Trouble lsp_type_definitions<CR>', desc = 'Goto type definition' },
{ 'K', vim.lsp.buf.hover, desc = 'Hover' },
{ 'gK', vim.lsp.buf.signature_help, desc = 'Signature help', has = 'signatureHelp' },
{ '<c-k>', vim.lsp.buf.signature_help, mode = 'i', desc = 'Signature help', has = 'signatureHelp' },
{ '<C-k>', vim.lsp.buf.signature_help, mode = 'i', desc = 'Signature help', has = 'signatureHelp' },
{ ']d', M.diagnostic_goto(true), desc = 'Next diagnostic' },
{ '[d', M.diagnostic_goto(false), desc = 'Previous diagnostic' },
{ ']e', M.diagnostic_goto(true, 'ERROR'), desc = 'Next error' },
@ -52,8 +46,14 @@ function M.get()
end
function M.on_attach(client, buffer)
local spec = M.get()
-- Add LSP server specific key bindings
local servers = require('user.plugins.lsp.lspconfig.servers')
vim.list_extend(spec, servers[client.name] and servers[client.name].keys or {})
local Keys = require('lazy.core.handler.keys')
local keymaps = Keys.resolve(M.get())
local keymaps = Keys.resolve(spec)
for _, keys in pairs(keymaps) do
local method = keys.has

View File

@ -1,28 +1,5 @@
local servers_path = vim.fn.stdpath('data') .. '/lsp'
-- NOTE: check https://github.com/folke/neodev.nvim for more bloated library/runtime path
local function lua_lib_path()
local lib_path = {}
lib_path[os.getenv('VIMRUNTIME') .. '/lua'] = true
-- emmylua-nvim
lib_path[vim.fn.stdpath('data') .. '/lazy/emmylua-nvim'] = true
return lib_path
end
local function lua_runtime_path()
local runtime_path = {}
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
local lib_path = lua_lib_path()
for lib, _ in pairs(lib_path) do
table.insert(runtime_path, lib .. '/?.lua')
table.insert(runtime_path, lib .. '/?/init.lua')
end
return runtime_path
end
-- Read a file line by line and build a table from them
---@param file string
local function read_dict(file)
@ -36,19 +13,50 @@ local function read_dict(file)
return dict
end
local function get_binary_paths(binaries)
local paths = {}
for _, bin in ipairs(binaries) do
local path = vim.fn.exepath(bin)
if path ~= '' then
table.insert(paths, path)
end
end
return table.concat(paths, ',')
end
return {
beancount = { init_options = { journalFile = os.getenv('HOME') .. '/Documents/Ledger/ledger.beancount' } },
clangd = {
keys = {
{ '<localleader>h', '<cmd>ClangdSwitchSourceHeader<CR>', mode = 'n', desc = 'Switch source header' },
},
init_options = {
clangdFileStatus = true,
},
cmd = {
'clangd',
'-j=4',
'--enable-config',
'--query-driver=' .. get_binary_paths { 'clang', 'clang++', 'gcc', 'g++' },
'--background-index',
'--clang-tidy',
'--all-scopes-completion',
'--completion-style=detailed',
'--pch-storage=memory',
'--header-insertion=iwyu',
'--header-insertion-decorators',
'--import-insertions',
},
},
lua_ls = {
settings = {
Lua = {
codeLens = { enable = true },
diagnostics = { globals = { 'vim', 'it', 'describe' } },
format = { enable = false },
hint = { enable = true, arrayIndex = 'Disable', setType = true },
runtime = { version = 'LuaJIT', path = lua_runtime_path() },
completion = { callSnippet = 'Replace', keywordSnippet = 'Replace' },
workspace = { checkThirdParty = false, library = lua_lib_path() },
telemetry = { enable = false },
workspace = { checkThirdParty = false },
},
},
},
@ -147,13 +155,16 @@ return {
},
validate = true,
schemas = require('schemastore').yaml.schemas(),
schemaStore = { enable = false, url = "" },
schemaStore = { enable = false, url = '' },
-- https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#configure-your-ide-to-support-reference-tags
customTags = { '!reference sequence' },
},
},
},
texlab = {
keys = {
{ '<localleader>p', '<cmd>TexlabForward<CR>', mode = 'n', desc = 'Preview LaTEX buffer' },
},
settings = {
texlab = {
build = { onSave = true },
@ -177,12 +188,19 @@ return {
nil_ls = {
settings = {
['nil'] = {
formatting = {
command = { 'nixpkgs-fmt' },
},
formatting = { command = { 'nixpkgs-fmt' } },
-- nix = { flake = { autoEvalInputs = true } },
},
},
},
-- nixd = {
-- settings = {
-- nixd = {
-- formatting = { command = "nixpkgs-fmt" },
-- options = { enable = true },
-- },
-- },
-- },
-- volar = {
-- { cmd = { servers_path .. '/volar/node_modules/.bin/vue-language-server', '--stdio' } },
-- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
@ -208,7 +226,9 @@ return {
bashls = { cmd = { servers_path .. '/bashls/node_modules/.bin/bash-language-server', 'start' } },
cssls = { cmd = { servers_path .. '/vscode/node_modules/.bin/vscode-css-language-server', '--stdio' } },
dockerls = { cmd = { servers_path .. '/dockerls/node_modules/.bin/docker-langserver', '--stdio' } },
emmet_language_server = { cmd = { servers_path .. '/emmet_language_server/node_modules/.bin/emmet-language-server', '--stdio' } },
emmet_language_server = {
cmd = { servers_path .. '/emmet_language_server/node_modules/.bin/emmet-language-server', '--stdio' },
},
html = { cmd = { servers_path .. '/vscode/node_modules/.bin/vscode-html-language-server', '--stdio' } },
-- please = { cmd = { 'build_langserver', '--mode', 'stdio' } },
ruff_lsp = { cmd = { servers_path .. '/ruff_lsp/bin/ruff-lsp' } },
@ -217,10 +237,10 @@ return {
tsserver = { cmd = { servers_path .. '/tsserver/node_modules/.bin/typescript-language-server', '--stdio' } },
dhall_lsp_server = {},
gleam = {},
glint = {}, -- this uses a project's local instance of glint-language-server (`pnpm add -D @glint/core`)
jsonnet_ls = {},
marksman = {},
nickel_ls = {},
-- nixd = {},
-- pylyzer = {},
qmlls = {}, -- from qt6-qtdeclarative-dev package in Alpine
regols = {},

View File

@ -188,13 +188,46 @@ M.lsp_servers = {
condition = conditions.lsp_attached,
update = { 'LspAttach', 'LspDetach' },
provider = function()
return '  [' .. table.concat(lsp_utils.lsp_active_clients(), ', ') .. ']'
local clients = {}
for _, client in ipairs(lsp_utils.active_lsp_clients { bufnr = 0 }) do
table.insert(clients, client.name)
end
return '  [' .. table.concat(clients, ', ') .. ']'
end,
hl = { fg = 'purple' },
}
M.linters_formatters = {
condition = function()
return misc_utils.loaded('conform.nvim') or misc_utils.loaded('nvim-lint')
end,
update = { 'BufReadPost', 'BufWritePost', 'InsertLeave' },
provider = function()
local ret = {}
if misc_utils.loaded('nvim-lint') then
vim.list_extend(ret, lsp_utils.active_linters(0))
end
if misc_utils.loaded('conform.nvim') then
for _, formatter in ipairs(require('conform').list_formatters()) do
if formatter and formatter.name and (not vim.tbl_contains(ret, formatter.name)) then
table.insert(ret, formatter.name)
end
end
end
return '  [' .. table.concat(ret, ', ') .. ']'
end,
hl = { fg = 'cyan' },
}
M.navic = {
condition = function()
if not misc_utils.loaded('nvim-navic') then
return false
end
return require('nvim-navic').is_available()
end,
provider = function()
@ -298,8 +331,11 @@ M.git = {
M.debugger = {
condition = function()
local session = require('dap').session()
return session ~= nil
if not misc_utils.loaded('nvim-dap') then
return false
end
return require('dap').session() ~= nil
end,
provider = function()
return '' .. require('dap').status()

View File

@ -89,6 +89,7 @@ require('heirline').setup {
components.diagnostics,
components.align,
{ components.lsp_servers, flexible = 1 },
{ components.linters_formatters, flexible = 1 },
},
-- Regular winbar
{
@ -96,6 +97,7 @@ require('heirline').setup {
components.align,
components.diagnostics,
{ components.lsp_servers, flexible = 1 },
{ components.linters_formatters, flexible = 1 },
},
},
opts = {

View File

@ -1,15 +1,44 @@
local M = {}
local lazy_util = require('lazy.core.util')
--- Return the list of active LSP clients
---@return table
function M.lsp_active_clients()
local clients = {}
for _, client in ipairs(vim.lsp.get_active_clients { bufnr = 0 }) do
table.insert(clients, client.name)
function M.active_lsp_clients(opts)
local clients = vim.lsp.get_active_clients(opts)
if opts and opts.method then
clients = vim.tbl_filter(function(client)
return client.supports_method(opts.method, { bufnr = opts.bufnr })
end, clients)
end
return clients
return (opts and opts.filter) and vim.tbl_filter(opts.filter, clients) or clients
end
--- Return the list of active nvim-lint linters for the current buffer
---@return table
function M.active_linters(bufnr)
local lint = require('lint')
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
local linters = vim.list_slice(lint._resolve_linter_by_ft(ft))
-- Add global and fallback linters
if #linters == 0 then
vim.list_extend(linters, lint.linters_by_ft['_'] or {})
end
vim.list_extend(linters, lint.linters_by_ft['*'] or {})
-- Filtering based on provided condition field
local filename = vim.api.nvim_buf_get_name(bufnr)
linters = vim.tbl_filter(function(name)
local conf = lint.linters[name]
if not conf then
lazy_util.warn('Linter not found: ' .. name, { title = 'nvim-lint' })
end
return conf and not (type(conf) == 'table' and conf.condition and not conf.condition(filename))
end, linters)
return linters
end
-- Re-implement nvim-lightbulb naively

View File

@ -13,6 +13,12 @@ function M.has(plugin)
return require('lazy.core.config').plugins[plugin] ~= nil
end
---@param plugin string
---@return boolean
function M.loaded(plugin)
return require('lazy.core.config').plugins[plugin]._.loaded
end
--- Switch between defined values of an option
---@param silent boolean?
---@param values? {[1]:any, [2]:any}