neovim type of stuff

This commit is contained in:
2026-03-15 13:53:38 +02:00
parent 01278e4351
commit e7db7f7581
6 changed files with 97 additions and 7 deletions

View File

@@ -20,7 +20,6 @@ vim.opt.inccommand = 'split'
vim.opt.cursorline = true
vim.opt.scrolloff = 10
-- vim.opt.textwidth = 80
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
@@ -210,11 +209,13 @@ vim.lsp.enable {
'svelte-language-server',
'rust-analyzer',
'emmet-language-server',
'tinymist',
'tsgo',
'tsls',
'qmlls',
'yamlls',
'ty',
}
vim.o.background = 'dark'
vim.cmd [[colorscheme gruvbox-material]]
vim.cmd [[colorscheme gruvbox]]

View File

@@ -0,0 +1,14 @@
---@brief
---
--- https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html
---
--- > QML Language Server is a tool shipped with Qt that helps you write code in your favorite (LSP-supporting) editor.
---
--- Source in the [QtDeclarative repository](https://code.qt.io/cgit/qt/qtdeclarative.git/)
---@type vim.lsp.Config
return {
cmd = { 'qmlls' },
filetypes = { 'qml', 'qmljs' },
root_markers = { '.git', 'shell.qml' },
}

View File

@@ -0,0 +1,69 @@
---@brief
---
--- https://github.com/Myriad-Dreamin/tinymist
--- An integrated language service for Typst [taɪpst]. You can also call it "微霭" [wēi ǎi] in Chinese.
---
--- Currently some of Tinymist's workspace commands are supported, namely:
--- `LspTinymistExportSvg`, `LspTinymistExportPng`, `LspTinymistExportPdf`,
--- `LspTinymistExportMarkdown`, `LspTinymistExportText`, `LspTinymistExportQuery`,
--- `LspTinymistExportAnsiHighlight`, `LspTinymistGetServerInfo`,
--- `LspTinymistGetDocumentTrace`, `LspTinymistGetWorkspaceLabels`,
--- `LspTinymistGetDocumentMetrics`, and `LspTinymistPinMain`.
---@param command_name string
---@param client vim.lsp.Client
---@param bufnr integer
---@return fun():nil run_tinymist_command, string cmd_name, string cmd_desc
local function create_tinymist_command(command_name, client, bufnr)
local export_type = command_name:match 'tinymist%.export(%w+)'
local info_type = command_name:match 'tinymist%.(%w+)'
local cmd_display = export_type or info_type:gsub('^get', 'Get'):gsub('^pin', 'Pin')
---@return nil
local function run_tinymist_command()
local arguments = { vim.api.nvim_buf_get_name(bufnr) }
local title_str = export_type and ('Export ' .. cmd_display) or cmd_display
---@type lsp.Handler
local function handler(err, res)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
end
vim.notify(vim.inspect(res), vim.log.levels.INFO)
end
return client:exec_cmd({
title = title_str,
command = command_name,
arguments = arguments,
}, { bufnr = bufnr }, handler)
end
-- Construct a readable command name/desc
local cmd_name = export_type and ('TinymistExport' .. cmd_display) or ('Tinymist' .. cmd_display) ---@type string
local cmd_desc = export_type and ('Export to ' .. cmd_display) or ('Get ' .. cmd_display) ---@type string
return run_tinymist_command, cmd_name, cmd_desc
end
---@type vim.lsp.Config
return {
cmd = { 'tinymist' },
filetypes = { 'typst' },
root_markers = { '.git' },
on_attach = function(client, bufnr)
for _, command in ipairs {
'tinymist.exportSvg',
'tinymist.exportPng',
'tinymist.exportPdf',
-- 'tinymist.exportHtml', -- Use typst 0.13
'tinymist.exportMarkdown',
'tinymist.exportText',
'tinymist.exportQuery',
'tinymist.exportAnsiHighlight',
'tinymist.getServerInfo',
'tinymist.getDocumentTrace',
'tinymist.getWorkspaceLabels',
'tinymist.getDocumentMetrics',
'tinymist.pinMain',
} do
local cmd_func, cmd_name, cmd_desc = create_tinymist_command(command, client, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd_name, cmd_func, { nargs = 0, desc = cmd_desc })
end
end,
}

View File

@@ -90,7 +90,6 @@ return {
},
cmd = { 'typescript-language-server', '--stdio' },
filetypes = {
'astro',
'vue',
},
root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' },

View File

@@ -26,18 +26,19 @@ return {
formatters_by_ft = {
lua = { 'stylua' },
go = { 'gofmt' },
python = { 'ruff', "black", stop_after_first = true},
python = { 'ruff', 'black', stop_after_first = true },
javascript = { 'biome', 'prettier', stop_after_first = true },
typescript = { 'biome', 'prettier', stop_after_first = true },
html = { 'biome', 'prettier', stop_after_first = true },
html = { 'prettier', stop_after_first = true },
css = { 'biome', 'prettier', stop_after_first = true },
rust = { 'rustfmt', lsp_format = 'fallback' },
json = { 'biome', 'prettier', stop_after_first = true },
astro = { 'biome', 'prettier', stop_after_first = true },
astro = { 'prettier', 'biome', stop_after_first = true },
vue = { 'biome', 'prettier' },
svelte = { 'biome', 'prettier', stop_after_first = true },
svelte = { 'prettier', 'biome', stop_after_first = true },
yaml = { 'prettier' },
php = { 'pint', stop_after_first = true },
typst = { 'typstyle', stop_after_first = true },
},
formatters = {
biome = {

View File

@@ -0,0 +1,6 @@
return {
'm4xshen/hardtime.nvim',
lazy = false,
dependencies = { 'MunifTanjim/nui.nvim' },
opts = {},
}