[nvim] Switch from Mason to Chezmoi

This commit is contained in:
aloslider
2026-04-21 03:42:54 +03:00
parent e70c3138ce
commit 6c16b57f3b
19 changed files with 83 additions and 140 deletions
+2
View File
@@ -7,11 +7,13 @@ packages:
- btop - btop
- bitwarden-cli - bitwarden-cli
- curl - curl
- dotnet-sdk
- eza - eza
- fzf - fzf
- git - git
- lazygit - lazygit
- paru - paru
- npm
- ripgrep - ripgrep
- tmux - tmux
- wget - wget
+10
View File
@@ -0,0 +1,10 @@
[".local/share/lua-language-server"]
type = "archive"
url = "https://github.com/LuaLS/lua-language-server/releases/download/3.18.2/lua-language-server-3.18.2-linux-x64.tar.gz"
exact = true
[".local/share/netcoredbg"]
type = "archive"
url = "https://github.com/Samsung/netcoredbg/releases/download/3.1.3-1062/netcoredbg-linux-amd64.tar.gz"
exact = true
stripComponents = 1
@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
{{ if -eq .chezmoi.osRelease.id "nixos" }} {{ if eq .chezmoi.osRelease.id "nixos" }}
exit 0 exit 0
{{ end }} {{ end }}
@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
{{ if -eq .chezmoi.osRelease.id "nixos" }} {{ if eq .chezmoi.osRelease.id "nixos" }}
exit 0 exit 0
{{ end }} {{ end }}
@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
{{ if -eq .chezmoi.osRelease.id "nixos" }} {{ if eq .chezmoi.osRelease.id "nixos" }}
exit 0 exit 0
{{ end }} {{ end }}
@@ -12,22 +12,26 @@ sudo pacman -Sy --noconfirm
pkgs=() pkgs=()
{{ range .packages.arch }} {{ range .packages.arch }}
pkgs+=("{{ . }}") if ! pacman -Q "{{ . }}" &>/dev/null; then
pkgs+=("{{ . }}")
fi
{{ end }} {{ end }}
if [[ ${#pkgs[@]} -gt 0 ]]; then if [[ ${#pkgs[@]} -gt 0 ]]; then
echo "Installing pacman packages" echo "Installing pacman packages"
sudo pacman -S --noconfirm "${pkgs[@]}" sudo pacman -S --noconfirm --needed "${pkgs[@]}"
fi fi
pkgs=() aur_pkgs=()
{{ range .packages.aur }} {{ range .packages.aur }}
pkgs+=("{{ . }}") if ! pacman -Q "{{ . }}" &>/dev/null; then
aur_pkgs+=("{{ . }}")
fi
{{ end }} {{ end }}
if [[ ${#pkgs[@]} -gt 0 ]]; then if [[ ${#aur_pkgs[@]} -gt 0 ]]; then
echo "Installing AUR packages" echo "Installing AUR packages"
paru -S --noconfirm "${pkgs[@]}" paru -S --noconfirm --needed "${aur_pkgs[@]}"
fi fi
{{ end }} {{ end }}
@@ -0,0 +1,18 @@
#!/bin/sh
{{ if eq .chezmoi.osRelease.id "nixos" }}
exit 0
{{ end }}
set -euo pipefail
echo "Installing LSPs for Neovim..."
npm install -g --prefix ~/.local \
@vtsls/language-server \
@vue/language-server \
vscode-langservers-extracted
dotnet tool install -g roslyn-language-server --prerelease
dotnet tool install -g csharpier
echo "Done"
@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
{{ if -eq .chezmoi.osRelease.id "nixos" }} exit 0
{{ if eq .chezmoi.osRelease.id "nixos" }}
exit 0 exit 0
{{ end }} {{ end }}
+2
View File
@@ -0,0 +1,2 @@
exit
q
+6 -21
View File
@@ -5,27 +5,12 @@ require("config.keymaps")
require("config.lazy") require("config.lazy")
require("config.theme") -- ignored by git require("config.theme") -- ignored by git
vim.lsp.config("roslyn", require("config.lsp.roslyn")) require("config.lsp")
vim.lsp.enable({ "nixd" }) -- installed locally vim.lsp.enable({
"lua_ls",
-- Set custom breakpoint style "html",
vim.fn.sign_define('DapBreakpoint', { "roslyn_ls",
text = '',
texthl = 'DapBreakpointSymbol',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
})
vim.fn.sign_define('DapStopped', {
text = '🔴',
texthl = 'yellow',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
})
vim.fn.sign_define('DapBreakpointRejected', {
text = '',
texthl = 'DapStoppedSymbol',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
}) })
require("config.diagnostics")
-9
View File
@@ -1,9 +0,0 @@
return {
settings = {
Lua = {
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
},
},
}
-54
View File
@@ -1,54 +0,0 @@
local vue_language_server_path = vim.fn.expand "$MASON/packages" .. "/vue-language-server" .. "/node_modules/@vue/language-server"
return {
cmd = { "vtsls", "--stdio" },
init_options = {
hostInfo = "neovim",
},
filetypes = {
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
},
root_dir = function(bufnr, on_dir)
-- The project root is where the LSP can be started from
-- As stated in the documentation above, this LSP supports monorepos and simple projects.
-- We select then from the project root, which is identified by the presence of a package
-- manager lock file.
local root_markers = { "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock" }
-- Give the root markers equal priority by wrapping them in a table
root_markers = vim.fn.has("nvim-0.11.3") == 1 and { root_markers, { ".git" } }
or vim.list_extend(root_markers, { ".git" })
-- exclude deno
local deno_root = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" })
local deno_lock_root = vim.fs.root(bufnr, { "deno.lock" })
local project_root = vim.fs.root(bufnr, root_markers)
if deno_lock_root and (not project_root or #deno_lock_root > #project_root) then
-- deno lock is closer than package manager lock, abort
return
end
if deno_root and (not project_root or #deno_root >= #project_root) then
-- deno config is closer than or equal to package manager lock, abort
return
end
-- project is standard TS, not deno
-- We fallback to the current working directory if no project root is found
on_dir(project_root or vim.fn.getcwd())
end,
settings = {
vtsls = {
tsserver = {
globalPlugins = {
{
name = "@vue/typescript-plugin",
location = vue_language_server_path,
languages = { "vue" },
configNamespace = "typescript",
}
}
}
}
},
}
@@ -0,0 +1,18 @@
vim.fn.sign_define('DapBreakpoint', {
text = '',
texthl = 'DapBreakpointSymbol',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
})
vim.fn.sign_define('DapStopped', {
text = '🔴',
texthl = 'yellow',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
})
vim.fn.sign_define('DapBreakpointRejected', {
text = '',
texthl = 'DapStoppedSymbol',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint'
})
+6
View File
@@ -0,0 +1,6 @@
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
vim.lsp.config("html", {
capabilities = capabilities,
})
@@ -4,10 +4,9 @@ return {
config = function() config = function()
local dap = require("dap") local dap = require("dap")
local utils = require("dap-dll-autopicker") local utils = require("dap-dll-autopicker")
local mason_path = vim.fn.stdpath("data") .. "/mason/packages/netcoredbg/netcoredbg"
local netcoredbg_adapter = { local netcoredbg_adapter = {
type = "executable", type = "executable",
command = mason_path, command = "netcoredbg",
args = { "--interpreter=vscode" }, args = { "--interpreter=vscode" },
} }
dap.adapters.netcoredbg = netcoredbg_adapter dap.adapters.netcoredbg = netcoredbg_adapter
@@ -1,38 +0,0 @@
return {
{
"mason-org/mason-lspconfig.nvim",
dependencies = { "neovim/nvim-lspconfig", },
opts = {
ensure_installed = {
"docker_compose_language_service",
"lua_ls",
"html",
-- "roslyn", install with :MasonInstall
"vtsls",
"vue_ls",
},
},
},
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = { "neovim/nvim-lspconfig", },
opts = {
ensure_installed = {
"coreclr",
}
}
},
{
"neovim/nvim-lspconfig",
dependencies = { "mason-org/mason.nvim", }
},
{
"mason-org/mason.nvim",
opts = {
registries = {
"github:mason-org/mason-registry",
"github:Crashdummyy/mason-registry",
},
}
}
}
@@ -0,0 +1,3 @@
return {
"neovim/nvim-lspconfig"
}
@@ -1,6 +0,0 @@
return {
"seblyng/roslyn.nvim",
---@module 'roslyn.config'
---@type RoslynNvimConfig
opts = {},
}
@@ -0,0 +1 @@
{{ .chezmoi.homeDir }}/.local/share/lua-language-server/bin/lua-language-server
+1
View File
@@ -0,0 +1 @@
{{ .chezmoi.homeDir }}/.local/share/netcoredbg/netcoredbg