update+spade

This commit is contained in:
2026-06-06 12:11:51 +02:00
parent 7c2edc0ea3
commit 3f4f5e47d8
5 changed files with 76 additions and 43 deletions

View File

@ -84,3 +84,9 @@ vim.filetype.add({
h = "c",
},
})
vim.filetype.add({
extension = {
spade = "spade",
},
})

View File

@ -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 = {

View File

@ -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", {

View File

@ -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' }, '<c-p>', 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' }, '<c-n>', 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' })