From 3f4f5e47d885b3b42c9ec0ff72a2287100ea5850 Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Sat, 6 Jun 2026 12:11:51 +0200 Subject: [PATCH] update+spade --- lua/config.lua | 6 +++++ lua/plugins/cmp.lua | 35 +++++++++++++++------------- lua/plugins/lsp.lua | 1 + lua/plugins/treesitter.lua | 47 ++++++++++++++++++++++++++------------ nvim-pack-lock.json | 30 +++++++++++++----------- 5 files changed, 76 insertions(+), 43 deletions(-) diff --git a/lua/config.lua b/lua/config.lua index 50deb51..c621b84 100644 --- a/lua/config.lua +++ b/lua/config.lua @@ -84,3 +84,9 @@ vim.filetype.add({ h = "c", }, }) + +vim.filetype.add({ + extension = { + spade = "spade", + }, +}) diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 25e73bc..9ea0e0b 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -1,20 +1,20 @@ -- To use mini icons with blink.cmp local function get_mini_icon(ctx) - if ctx.source_name == "Path" then - local is_unknown_type = vim.tbl_contains( - { "link", "socket", "fifo", "char", "block", "unknown" }, - ctx.item.data.type - ) - local mini_icon, mini_hl, _ = require("mini.icons").get( - is_unknown_type and "os" or ctx.item.data.type, - is_unknown_type and "" or ctx.label - ) - if mini_icon then - return mini_icon, mini_hl + if ctx.source_name == "Path" then + local is_unknown_type = vim.tbl_contains( + { "link", "socket", "fifo", "char", "block", "unknown" }, + ctx.item.data.type + ) + local mini_icon, mini_hl, _ = require("mini.icons").get( + is_unknown_type and "os" or ctx.item.data.type, + is_unknown_type and "" or ctx.label + ) + if mini_icon then + return mini_icon, mini_hl + end end - end - local mini_icon, mini_hl, _ = require("mini.icons").get("lsp", ctx.kind) - return mini_icon, mini_hl + local mini_icon, mini_hl, _ = require("mini.icons").get("lsp", ctx.kind) + return mini_icon, mini_hl end vim.api.nvim_create_autocmd('PackChanged', { @@ -33,7 +33,8 @@ vim.api.nvim_create_autocmd('PackChanged', { vim.pack.add({ "https://github.com/xzbdmw/colorful-menu.nvim", - { src = "https://github.com/saghen/blink.cmp", verion = vim.version.range("1.x") }, + { src = "https://github.com/saghen/blink.lib" }, + { src = "https://github.com/saghen/blink.cmp" }, }) -- You don't need to set these options. @@ -79,7 +80,9 @@ vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "FloatBorder" }) vim.api.nvim_set_hl(0, "BlinkCmpDoc", { link = "NormalFloat" }) vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "FloatBorder" }) -require("blink.cmp").setup({ +local cmp = require('blink.cmp') +cmp.build():pwait() +cmp.setup({ keymap = { preset = "super-tab" }, signature = { enabled = true }, sources = { diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 49f0d40..f37e704 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -5,6 +5,7 @@ require("fidget").setup() vim.lsp.enable({ 'lua_ls' }) vim.lsp.enable({ 'clangd' }) +vim.lsp.enable({ 'spade_ls' }) -- vim.lsp.enable({ 'metals' }) vim.lsp.config("rust_analyzer", { diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 4fa6eb4..fe38df8 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -13,6 +13,24 @@ vim.pack.add( ) local ts = require('nvim-treesitter') +-- require('nvim-treesitter.install').prefer_git = true + +vim.api.nvim_create_autocmd('User', { + pattern = 'TSUpdate', + callback = function() + require('nvim-treesitter.parsers').spade = { + install_info = { + path = "~/coding-projects/tree-sitter-spade/", -- local path or git repo + generate = true, + -- optional entries: + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + queries = "queries/nvim" + }, + filetype = "spade" + } + end +}) + ts.setup { -- Directory to install parsers and queries to (prepended to `runtimepath` to have priority) install_dir = vim.fn.stdpath('data') .. '/site', @@ -23,6 +41,7 @@ ts.setup { indent = { enable = false }, } + local languages = { "bash", @@ -43,6 +62,7 @@ local languages = "vimdoc", "yaml", "wgsl", + "spade" } ts.install(languages):wait(300000) @@ -51,31 +71,30 @@ for _, lang in pairs(languages) do vim.api.nvim_create_autocmd('FileType', { pattern = { lang }, callback = function() vim.treesitter.start() end, - }) + }) end -- Incremental selection keybindings vim.keymap.set({ 'x' }, '', function() - require 'vim.treesitter._select'.select_prev(vim.v.count1) + require 'vim.treesitter._select'.select_prev(vim.v.count1) end, { desc = 'Select previous treesitter node' }) vim.keymap.set({ 'x' }, '', function() - require 'vim.treesitter._select'.select_next(vim.v.count1) + require 'vim.treesitter._select'.select_next(vim.v.count1) end, { desc = 'Select next treesitter node' }) vim.keymap.set({ 'x', 'o' }, 'v', function() - if vim.treesitter.get_parser(nil, nil, { error = false }) then - require 'vim.treesitter._select'.select_parent(vim.v.count1) - else - vim.lsp.buf.selection_range(vim.v.count1) - end + if vim.treesitter.get_parser(nil, nil, { error = false }) then + require 'vim.treesitter._select'.select_parent(vim.v.count1) + else + vim.lsp.buf.selection_range(vim.v.count1) + end end, { desc = 'Select parent treesitter node or outer incremental lsp selections' }) vim.keymap.set({ 'x', 'o' }, 'V', function() - if vim.treesitter.get_parser(nil, nil, { error = false }) then - require 'vim.treesitter._select'.select_child(vim.v.count1) - else - vim.lsp.buf.selection_range(-vim.v.count1) - end + if vim.treesitter.get_parser(nil, nil, { error = false }) then + require 'vim.treesitter._select'.select_child(vim.v.count1) + else + vim.lsp.buf.selection_range(-vim.v.count1) + end end, { desc = 'Select child treesitter node or inner incremental lsp selections' }) - diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 876f899..7c3b9c6 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -5,15 +5,19 @@ "src": "https://github.com/numToStr/Comment.nvim" }, "blink.cmp": { - "rev": "a327b19a419347084074cce77f6cd074f54705ac", + "rev": "43cb60895ee109161ae5cffa26444018cc07e570", "src": "https://github.com/saghen/blink.cmp" }, + "blink.lib": { + "rev": "c09dd66e9ad97e1a7777f3fa5f0504ca2e877231", + "src": "https://github.com/saghen/blink.lib" + }, "colorful-menu.nvim": { - "rev": "b51a659459df8d078201aefc995db8175ed55e84", + "rev": "13f9b7eaa9cd2901b4f8915cfb2483c3be4c8c20", "src": "https://github.com/xzbdmw/colorful-menu.nvim" }, "conform.nvim": { - "rev": "dca1a190aa85f9065979ef35802fb77131911106", + "rev": "619363c30309d29ffa631e67c8183f2a72caa373", "src": "https://github.com/stevearc/conform.nvim" }, "fidget.nvim": { @@ -25,7 +29,7 @@ "src": "https://github.com/folke/flash.nvim" }, "gitsigns.nvim": { - "rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d", + "rev": "dd3f588bacbeb041be6facf1742e42097f62165d", "src": "https://github.com/lewis6991/gitsigns.nvim" }, "lsp_lines.nvim": { @@ -41,15 +45,15 @@ "src": "https://github.com/savq/melange-nvim" }, "mini.comment": { - "rev": "8e5ff3ed3cc0e8f216617aae01020c00c20f7a87", + "rev": "fc87ba6554f182161d9a4bab5017c575571f000f", "src": "https://github.com/nvim-mini/mini.comment" }, "mini.icons": { - "rev": "7fdae2443a0e2910015ca39ad74b50524ee682d3", + "rev": "520995f1d75da0e4cc901ee95080b1ff2bc46b94", "src": "https://github.com/nvim-mini/mini.icons" }, "mini.surround": { - "rev": "2715e04bea3ec9244f15b421dc5b18c0fe326210", + "rev": "d12d8e6ea8e4d9d3e6fb0e3ff11c84fcce2299ac", "src": "https://github.com/nvim-mini/mini.surround" }, "multicursor.nvim": { @@ -61,11 +65,11 @@ "src": "https://github.com/danymat/neogen" }, "neovim": { - "rev": "6a961effd67f6130d36df6d1c05c48c739796dd2", + "rev": "ff483051a47e27d84bdef47703538df1ed9f4a47", "src": "https://github.com/rose-pine/neovim" }, "nvim-lspconfig": { - "rev": "bedca8b426b2fee0ccac596d167d71bbe971253f", + "rev": "07dff35e7c95288861200b788ef32d6103f107f0", "src": "https://github.com/neovim/nvim-lspconfig" }, "nvim-metals": { @@ -78,19 +82,19 @@ "version": "'main'" }, "oil.nvim": { - "rev": "0fcc83805ad11cf714a949c98c605ed717e0b83e", + "rev": "b91ee5a77a6a9605d9c1aaf4fda74b66082c8297", "src": "https://github.com/stevearc/oil.nvim" }, "plenary.nvim": { - "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", "src": "https://github.com/nvim-lua/plenary.nvim" }, "telescope-fzf-native.nvim": { - "rev": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c", + "rev": "b25b749b9db64d375d782094e2b9dce53ad53a40", "src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim" }, "telescope.nvim": { - "rev": "7ef4d6dccb78ee71e552bbd866176762ad328afa", + "rev": "7d324792b7943e4aa16ad007212e6acc6f9fe335", "src": "https://github.com/nvim-lua/telescope.nvim" } }