From 54ebad9151df3759db54a30d877401cf2f974dc4 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Thu, 13 Jul 2023 12:28:23 +0800 Subject: [PATCH] fix: astronvim - install lsp, fomatters and others via home-manager instead of mason.nvim --- home/base/desktop/neovim/README.md | 6 --- .../desktop/neovim/astronvim_user/init.lua | 38 ++++++++++++++++++- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/home/base/desktop/neovim/README.md b/home/base/desktop/neovim/README.md index 2887e5ad..3e899660 100644 --- a/home/base/desktop/neovim/README.md +++ b/home/base/desktop/neovim/README.md @@ -2,12 +2,6 @@ My Neovim config based on AstroNvim. -## TODO - -- [ ] Install language servers, formatters, and others via nix home manager, instead of mason.nvim! - - currently some plugins(markdown/clangd/...) failed to start due to this problem. - - Temporary solution: `rm ~/.local/share/nvim/mason/bin/*`, but do not remove `emmet-ls`, cause it's not found in nixpkgs! - ## Screenshots ![](/_img/astronvim_2023-07-13_00-39.webp) diff --git a/home/base/desktop/neovim/astronvim_user/init.lua b/home/base/desktop/neovim/astronvim_user/init.lua index 26b03bc4..58b70406 100644 --- a/home/base/desktop/neovim/astronvim_user/init.lua +++ b/home/base/desktop/neovim/astronvim_user/init.lua @@ -5,7 +5,9 @@ return { opt = { relativenumber = true, -- Show relative numberline signcolumn = "auto", -- Show sign column when used only - spell = false, -- Enable spell checking + spell = false, -- Spell checking + swapfile = false, -- Swapfile + }, }, @@ -79,6 +81,39 @@ return { }, }, }, + + -- Install lsp, formmatter and others via home manager instead of Mason.nvim + -- LSP installations + { + "williamboman/mason-lspconfig.nvim", + -- ensure_installed nothing + opts = function(_, opts) opts.ensure_installed = { + "emmet_ls", -- not exist in nixpkgs, so install it via mason + } end, + }, + -- Formatters/Linter installation + { + "jay-babu/mason-null-ls.nvim", + -- ensure_installed nothing + opts = function(_, opts) opts.ensure_installed = {} end, + }, + -- Debugger installationl + { + "jay-babu/mason-nvim-dap.nvim", + -- overrides `require("mason-nvim-dap").setup(...)` + opts = function(_, opts) opts.ensure_installed = {} end, + }, + }, + + -- Configure require("lazy").setup() options + lazy = { + defaults = { lazy = true }, + performance = { + rtp = { + -- customize default disabled vim plugins + disabled_plugins = { }; + }, + }, }, lsp = { @@ -91,6 +126,7 @@ return { }, }, }, + -- enable servers that installed by home-manager instead of mason servers = { "dockerls", "jsonnet_ls", -- jsonnet language server