mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 01:26:46 +00:00
neovim type of stuff
This commit is contained in:
@@ -20,7 +20,6 @@ vim.opt.inccommand = 'split'
|
|||||||
vim.opt.cursorline = true
|
vim.opt.cursorline = true
|
||||||
vim.opt.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
-- vim.opt.textwidth = 80
|
-- vim.opt.textwidth = 80
|
||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.opt.clipboard = 'unnamedplus'
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
end)
|
end)
|
||||||
@@ -210,11 +209,13 @@ vim.lsp.enable {
|
|||||||
'svelte-language-server',
|
'svelte-language-server',
|
||||||
'rust-analyzer',
|
'rust-analyzer',
|
||||||
'emmet-language-server',
|
'emmet-language-server',
|
||||||
|
'tinymist',
|
||||||
'tsgo',
|
'tsgo',
|
||||||
'tsls',
|
'tsls',
|
||||||
|
'qmlls',
|
||||||
'yamlls',
|
'yamlls',
|
||||||
'ty',
|
'ty',
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.o.background = 'dark'
|
vim.o.background = 'dark'
|
||||||
vim.cmd [[colorscheme gruvbox-material]]
|
vim.cmd [[colorscheme gruvbox]]
|
||||||
|
|||||||
14
.config/nvim/lsp/qmlls.lua
Normal file
14
.config/nvim/lsp/qmlls.lua
Normal 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' },
|
||||||
|
}
|
||||||
69
.config/nvim/lsp/tinymist.lua
Normal file
69
.config/nvim/lsp/tinymist.lua
Normal 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,
|
||||||
|
}
|
||||||
@@ -90,7 +90,6 @@ return {
|
|||||||
},
|
},
|
||||||
cmd = { 'typescript-language-server', '--stdio' },
|
cmd = { 'typescript-language-server', '--stdio' },
|
||||||
filetypes = {
|
filetypes = {
|
||||||
'astro',
|
|
||||||
'vue',
|
'vue',
|
||||||
},
|
},
|
||||||
root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' },
|
root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' },
|
||||||
|
|||||||
@@ -26,18 +26,19 @@ return {
|
|||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
go = { 'gofmt' },
|
go = { 'gofmt' },
|
||||||
python = { 'ruff', "black", stop_after_first = true},
|
python = { 'ruff', 'black', stop_after_first = true },
|
||||||
javascript = { 'biome', 'prettier', stop_after_first = true },
|
javascript = { 'biome', 'prettier', stop_after_first = true },
|
||||||
typescript = { '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 },
|
css = { 'biome', 'prettier', stop_after_first = true },
|
||||||
rust = { 'rustfmt', lsp_format = 'fallback' },
|
rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||||
json = { 'biome', 'prettier', stop_after_first = true },
|
json = { 'biome', 'prettier', stop_after_first = true },
|
||||||
astro = { 'biome', 'prettier', stop_after_first = true },
|
astro = { 'prettier', 'biome', stop_after_first = true },
|
||||||
vue = { 'biome', 'prettier' },
|
vue = { 'biome', 'prettier' },
|
||||||
svelte = { 'biome', 'prettier', stop_after_first = true },
|
svelte = { 'prettier', 'biome', stop_after_first = true },
|
||||||
yaml = { 'prettier' },
|
yaml = { 'prettier' },
|
||||||
php = { 'pint', stop_after_first = true },
|
php = { 'pint', stop_after_first = true },
|
||||||
|
typst = { 'typstyle', stop_after_first = true },
|
||||||
},
|
},
|
||||||
formatters = {
|
formatters = {
|
||||||
biome = {
|
biome = {
|
||||||
|
|||||||
6
.config/nvim/lua/plugins/hardtime.lua
Normal file
6
.config/nvim/lua/plugins/hardtime.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
'm4xshen/hardtime.nvim',
|
||||||
|
lazy = false,
|
||||||
|
dependencies = { 'MunifTanjim/nui.nvim' },
|
||||||
|
opts = {},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user