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

View File

@@ -23,6 +23,35 @@
programs.zen-browser.enable = true; 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 = programs.spicetify =
let let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; 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 // This config is in the KDL format: https://kdl.dev
// "/-" comments out the following node. // "/-" comments out the following node.
// Check the wiki for a full description of the configuration: // 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/coq.lua".source = ./lua/plugins/coq.lua;
".config/nvim/lua/plugins/blink-cmp.lua".source = ./lua/plugins/blink-cmp.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/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/treesitter.lua".source = ./lua/plugins/treesitter.lua;
".config/nvim/lua/plugins/catppuccin.lua".source = ./lua/plugins/catppuccin.lua; ".config/nvim/lua/plugins/catppuccin.lua".source = ./lua/plugins/catppuccin.lua;
".config/nvim/lua/plugins/telescope.lua".source = ./lua/plugins/telescope.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>tv", ":ToggleTerm direction=vertical <CR>", { desc = "Open terminal vertical" })
vim.keymap.set("n", "<leader>ts", ":ToggleTerm direction=vertical <CR>", { desc = "select open terminal" }) vim.keymap.set("n", "<leader>ts", ":ToggleTerm direction=vertical <CR>", { desc = "select open terminal" })
-- file explorer binds (nvim-tree) -- 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 -- code actions
vim.keymap.set("n", "<leader>ca", function() vim.keymap.set("n", "<leader>ca", function()
require("tiny-code-action").code_action() require("tiny-code-action").code_action()
@@ -154,3 +154,5 @@ end, { desc = "Show code actions", noremap = true, silent = true })
-- disable annoying inline type things -- disable annoying inline type things
vim.lsp.inlay_hint.enable(false) vim.lsp.inlay_hint.enable(false)
vim.diagnostic.config({virtual_text = false}) vim.diagnostic.config({virtual_text = false})

View File

@@ -1,32 +1,69 @@
return { return {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { 'saghen/blink.cmp' }, dependencies = { 'saghen/blink.cmp' },
config = function(_,_)
-- example using `opts` for defining servers local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server'
opts = {
servers = { local tsserver_filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }
lua_ls = {}, local vue_plugin = {
nil_ls = {}, name = '@vue/typescript-plugin',
vue_ls = {}, location = vue_language_server_path,
-- rust_analyzer = {}, languages = { 'vue' },
-- gopls = {}, configNamespace = 'typescript',
} }
local vtsls_config = {
settings = {
vtsls = {
tsserver = {
globalPlugins = {
vue_plugin,
}, },
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 filetypes = tsserver_filetypes,
-- `opts[server].capabilities, if you've defined it }
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config) local ts_ls_config = {
end 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 end
-- -- example calling setup directly for each LSP
-- config = function() -- opts = {
-- local capabilities = require('blink.cmp').get_lsp_capabilities() -- servers = {
-- local lspconfig = require('lspconfig') -- 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)
-- --
-- lspconfig['lua_ls'].setup({ capabilities = capabilities }) -- -- Verwende `vim.lsp.config` um die Konfiguration anzupassen
-- vim.lsp.config(server, config)
--
-- -- Aktiviere die Konfiguration
-- vim.lsp.enable(server)
-- end
-- 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 { return {
"mason-org/mason.nvim",
"williamboman/mason.nvim", config = function ()
cmd = "Mason", require("mason").setup()
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)
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,
-- }