From 2224c25e2bd2af7a66139bf1aa0c93b76f0003dc Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 24 Oct 2025 19:21:22 +0200 Subject: [PATCH] Change nvim lspconfig to work with mason and vue --- configuration.nix | 39 +++++++-- home-nico.nix | 31 ++++++- packages/niri/config.kdl | 8 ++ packages/nvim/default.nix | 3 +- packages/nvim/init.lua | 4 +- packages/nvim/lua/plugins/lsp.lua | 85 +++++++++++++------ packages/nvim/lua/plugins/mason-lspconfig.lua | 8 ++ packages/nvim/lua/plugins/mason.lua | 79 +++++++++-------- 8 files changed, 186 insertions(+), 71 deletions(-) create mode 100644 packages/nvim/lua/plugins/mason-lspconfig.lua diff --git a/configuration.nix b/configuration.nix index ca21300..441f0a9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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; }; diff --git a/home-nico.nix b/home-nico.nix index 49a74a2..baa1bae 100644 --- a/home-nico.nix +++ b/home-nico.nix @@ -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}; diff --git a/packages/niri/config.kdl b/packages/niri/config.kdl index 9979899..001f9e9 100644 --- a/packages/niri/config.kdl +++ b/packages/niri/config.kdl @@ -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: diff --git a/packages/nvim/default.nix b/packages/nvim/default.nix index d0836d1..acdf946 100644 --- a/packages/nvim/default.nix +++ b/packages/nvim/default.nix @@ -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; diff --git a/packages/nvim/init.lua b/packages/nvim/init.lua index 87450c2..9062fc0 100644 --- a/packages/nvim/init.lua +++ b/packages/nvim/init.lua @@ -145,7 +145,7 @@ vim.keymap.set("n", "tt", ":ToggleTerm direction=tab size=50 ", { de vim.keymap.set("n", "tv", ":ToggleTerm direction=vertical ", { desc = "Open terminal vertical" }) vim.keymap.set("n", "ts", ":ToggleTerm direction=vertical ", { desc = "select open terminal" }) -- file explorer binds (nvim-tree) -vim.keymap.set("n", "fe", ":NvimTreeToggle ", { desc = "select open terminal" }) +vim.keymap.set("n", "fe", ":NvimTreeToggle ", { desc = "Toggle nvim tree" }) -- code actions vim.keymap.set("n", "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}) + + diff --git a/packages/nvim/lua/plugins/lsp.lua b/packages/nvim/lua/plugins/lsp.lua index 916d2f1..ac40b51 100644 --- a/packages/nvim/lua/plugins/lsp.lua +++ b/packages/nvim/lua/plugins/lsp.lua @@ -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 } + diff --git a/packages/nvim/lua/plugins/mason-lspconfig.lua b/packages/nvim/lua/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..da4ffd4 --- /dev/null +++ b/packages/nvim/lua/plugins/mason-lspconfig.lua @@ -0,0 +1,8 @@ +return { + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, +} diff --git a/packages/nvim/lua/plugins/mason.lua b/packages/nvim/lua/plugins/mason.lua index 73457d4..bad19f3 100644 --- a/packages/nvim/lua/plugins/mason.lua +++ b/packages/nvim/lua/plugins/mason.lua @@ -1,37 +1,46 @@ return { - - "williamboman/mason.nvim", - cmd = "Mason", - keys = { { "cm", "Mason", 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 = { { "cm", "Mason", 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, +-- } +