Change nvim lspconfig to work with mason and vue

This commit is contained in:
Nico
2025-10-24 19:21:22 +02:00
parent f60bf4608f
commit 2224c25e2b
8 changed files with 186 additions and 71 deletions

View File

@@ -18,10 +18,10 @@
};
# hyprland
programs.hyprland = {
enable = true;
xwayland.enable = true;
};
# programs.hyprland = {
# enable = true;
# xwayland.enable = true;
# };
programs.niri.enable = true;
@@ -30,7 +30,7 @@
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.useOSProber = true;
# fileSystems."mnt/win" = {
# device = "/dev/sdb1";
@@ -76,6 +76,28 @@ boot.loader.efi.canTouchEfiVariables = true;
# Enable the X11 windowing system. You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-gnome
];
config = {
common = {
default = [ "gtk" ];
};
niri = {
default = [
"gtk"
"gnome"
];
"org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ];
"org.freedesktop.impl.portal.Screenshot" = [ "gnome" ];
};
};
};
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
@@ -91,10 +113,10 @@ boot.loader.efi.canTouchEfiVariables = true;
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = true;
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = false;
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
@@ -150,7 +172,6 @@ services.mullvad-vpn.enable = true;
heroic
wineWowPackages.stable
winetricks
bottles
spotify
#spicetify-cli
sshfs
@@ -187,7 +208,7 @@ hardware.amdgpu.opencl.enable = true;
services.gnome.gnome-keyring.enable = true;
programs.sway = {
enable = true;
enable = false;
wrapperFeatures.gtk = true;
};

View File

@@ -10,7 +10,7 @@
inputs.zen-browser.homeModules.default
];
nixpkgs = {
nixpkgs = {
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
@@ -23,6 +23,35 @@
programs.zen-browser.enable = true;
home.pointerCursor =
let
getFrom = url: hash: name: {
gtk.enable = true;
x11.enable = true;
name = name;
size = 48;
package =
pkgs.runCommand "moveUp" {} ''
mkdir -p $out/share/icons
ln -s ${pkgs.fetchzip {
url = url;
hash = hash;
}} $out/share/icons/${name}
'';
};
in
getFrom
"https://github.com/ful1e5/banana-cursor/releases/download/v2.0.0/Banana-Blue.tar.xz"
# "https://github.com/ful1e5/fuchsia-cursor/releases/download/v2.0.0/Fuchsia-Pop.tar.gz"
"sha256-IZ6sidRjcg0r+E2eFlVfIouTpKWndvrZlCNNYZMQJE0="
"Banana-Blue";
programs.spicetify =
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};

View File

@@ -1,3 +1,11 @@
cursor {
xcursor-theme "Banana-Blue"
xcursor-size 30
}
// This config is in the KDL format: https://kdl.dev
// "/-" comments out the following node.
// Check the wiki for a full description of the configuration:

View File

@@ -32,7 +32,8 @@ programs.neovim.plugins = [
# ".config/nvim/lua/plugins/coq.lua".source = ./lua/plugins/coq.lua;
".config/nvim/lua/plugins/blink-cmp.lua".source = ./lua/plugins/blink-cmp.lua;
".config/nvim/lua/plugins/lsp.lua".source = ./lua/plugins/lsp.lua;
# ".config/nvim/lua/plugins/mason.lua".source = ./lua/plugins/mason.lua;
".config/nvim/lua/plugins/mason.lua".source = ./lua/plugins/mason.lua;
".config/nvim/lua/plugins/mason-lspconfig.lua".source = ./lua/plugins/mason-lspconfig.lua;
# ".config/nvim/lua/plugins/treesitter.lua".source = ./lua/plugins/treesitter.lua;
".config/nvim/lua/plugins/catppuccin.lua".source = ./lua/plugins/catppuccin.lua;
".config/nvim/lua/plugins/telescope.lua".source = ./lua/plugins/telescope.lua;

View File

@@ -145,7 +145,7 @@ vim.keymap.set("n", "<leader>tt", ":ToggleTerm direction=tab size=50 <CR>", { de
vim.keymap.set("n", "<leader>tv", ":ToggleTerm direction=vertical <CR>", { desc = "Open terminal vertical" })
vim.keymap.set("n", "<leader>ts", ":ToggleTerm direction=vertical <CR>", { desc = "select open terminal" })
-- file explorer binds (nvim-tree)
vim.keymap.set("n", "<leader>fe", ":NvimTreeToggle <CR>", { desc = "select open terminal" })
vim.keymap.set("n", "<leader>fe", ":NvimTreeToggle <CR>", { desc = "Toggle nvim tree" })
-- code actions
vim.keymap.set("n", "<leader>ca", function()
require("tiny-code-action").code_action()
@@ -154,3 +154,5 @@ end, { desc = "Show code actions", noremap = true, silent = true })
-- disable annoying inline type things
vim.lsp.inlay_hint.enable(false)
vim.diagnostic.config({virtual_text = false})

View File

@@ -1,32 +1,69 @@
return {
'neovim/nvim-lspconfig',
dependencies = { 'saghen/blink.cmp' },
config = function(_,_)
-- example using `opts` for defining servers
opts = {
servers = {
lua_ls = {},
nil_ls = {},
vue_ls = {},
-- rust_analyzer = {},
-- gopls = {},
local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server'
local tsserver_filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }
local vue_plugin = {
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
configNamespace = 'typescript',
}
},
config = function(_, opts)
local lspconfig = require('lspconfig')
for server, config in pairs(opts.servers) do
-- passing config.capabilities to blink.cmp merges with the capabilities in your
-- `opts[server].capabilities, if you've defined it
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config)
end
local vtsls_config = {
settings = {
vtsls = {
tsserver = {
globalPlugins = {
vue_plugin,
},
},
},
},
filetypes = tsserver_filetypes,
}
local ts_ls_config = {
init_options = {
plugins = {
vue_plugin,
},
},
filetypes = tsserver_filetypes,
}
-- If you are on most recent `nvim-lspconfig`
local vue_ls_config = {}
-- nvim 0.11 or above
vim.lsp.config('vtsls', vtsls_config)
vim.lsp.config('vue_ls', vue_ls_config)
vim.lsp.config('lua_ls', {})
vim.lsp.enable({'vtsls', 'vue_ls', 'lua_ls'})
end
-- -- example calling setup directly for each LSP
-- config = function()
-- local capabilities = require('blink.cmp').get_lsp_capabilities()
-- local lspconfig = require('lspconfig')
--
-- lspconfig['lua_ls'].setup({ capabilities = capabilities })
-- end
-- opts = {
-- servers = {
-- lua_ls = {},
-- nil_ls = {},
-- vstls = {},
-- vue_ls = {},
-- -- rust_analyzer = {},
-- -- gopls = {},
-- }
-- },
-- config = function(_, opts)
-- for server, config in pairs(opts.servers) do
-- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
--
-- -- Verwende `vim.lsp.config` um die Konfiguration anzupassen
-- vim.lsp.config(server, config)
--
-- -- Aktiviere die Konfiguration
-- vim.lsp.enable(server)
-- end
-- end
}

View File

@@ -0,0 +1,8 @@
return {
"mason-org/mason-lspconfig.nvim",
opts = {},
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"neovim/nvim-lspconfig",
},
}

View File

@@ -1,37 +1,46 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts_extend = { "ensure_installed" },
opts = {
ensure_installed = {
"stylua",
"shfmt",
},
},
---@param opts MasonSettings | {ensure_installed: string[]}
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
mr:on("package:install:success", function()
vim.defer_fn(function()
-- trigger FileType event to possibly load this newly installed LSP server
require("lazy.core.handler.event").trigger({
event = "FileType",
buf = vim.api.nvim_get_current_buf(),
})
end, 100)
end)
mr.refresh(function()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end)
end,
"mason-org/mason.nvim",
config = function ()
require("mason").setup()
end
}
-- return {
--
-- "williamboman/mason.nvim",
-- cmd = "Mason",
-- keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
-- build = ":MasonUpdate",
-- opts_extend = { "ensure_installed" },
-- opts = {
-- ensure_installed = {
-- -- "stylua",
-- -- "shfmt",
-- },
-- },
-- ---@param opts MasonSettings | {ensure_installed: string[]}
-- config = function(_, opts)
-- require("mason").setup(opts)
-- local mr = require("mason-registry")
-- mr:on("package:install:success", function()
-- vim.defer_fn(function()
-- -- trigger FileType event to possibly load this newly installed LSP server
-- require("lazy.core.handler.event").trigger({
-- event = "FileType",
-- buf = vim.api.nvim_get_current_buf(),
-- })
-- end, 100)
-- end)
--
-- mr.refresh(function()
-- for _, tool in ipairs(opts.ensure_installed) do
-- local p = mr.get_package(tool)
-- if not p:is_installed() then
-- p:install()
-- end
-- end
-- end)
-- end,
-- }