From 2ca3a3448935f3ddd8705c7ae10f763f921ffc1c Mon Sep 17 00:00:00 2001 From: buffet Date: Tue, 16 Aug 2022 19:14:35 +0000 Subject: [PATCH] Add lsp-trouble --- flake.lock | 17 +++++ flake.nix | 10 ++- programs/nvim.nix | 163 ++++++++++++++++++++++++---------------------- 3 files changed, 111 insertions(+), 79 deletions(-) diff --git a/flake.lock b/flake.lock index 9e867ce..76f61d0 100644 --- a/flake.lock +++ b/flake.lock @@ -36,6 +36,22 @@ "type": "github" } }, + "lsp-trouble": { + "flake": false, + "locked": { + "lastModified": 1620090273, + "narHash": "sha256-Vrv9xWGANqruKwtWlb5jr/4i5bsM8mZiyG6FPENhi9w=", + "owner": "simrat39", + "repo": "lsp-trouble.nvim", + "rev": "315bda04bc48a6d28fc4417b69ec60458d354e7a", + "type": "github" + }, + "original": { + "owner": "simrat39", + "repo": "lsp-trouble.nvim", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1660496378, @@ -56,6 +72,7 @@ "inputs": { "home-manager": "home-manager", "impermanence": "impermanence", + "lsp-trouble": "lsp-trouble", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 651238c..e753134 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,17 @@ { inputs = { + impermanence.url = "github:nix-community/impermanence"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05"; + home-manager = { url = "github:nix-community/home-manager/release-22.05"; inputs.nixpkgs.follows = "nixpkgs"; }; - impermanence.url = "github:nix-community/impermanence"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05"; + + lsp-trouble = { + url = "github:simrat39/lsp-trouble.nvim"; + flake = false; + }; }; outputs = {nixpkgs, ...} @ args: { diff --git a/programs/nvim.nix b/programs/nvim.nix index d0806b7..1ca2153 100644 --- a/programs/nvim.nix +++ b/programs/nvim.nix @@ -2,7 +2,7 @@ lib, pkgs, ... -}: { +} @ inputs: { home-manager.users.buffet = { home.sessionVariables = { EDITOR = "nvim"; @@ -13,89 +13,98 @@ # TODO: options programs.neovim = { enable = true; - plugins = with pkgs.vimPlugins; [ - # TODO: vimplugin lsp-trouble - # TODO: vimplugin nvim-lspconfig - {plugin = editorconfig-nvim;} - {plugin = fugitive;} - {plugin = nvim-autopairs;} - {plugin = rust-vim;} - {plugin = tabular;} - {plugin = vim-nix;} - {plugin = vim-repeat;} - {plugin = vimwiki;} + plugins = let + buildPlugin = name: + pkgs.vimUtils.buildNeovimPluginFrom2Nix { + inherit name; + src = inputs."${name}"; + }; + buildPlugins = names: lib.attrsets.genAttrs names buildPlugin; + plugins = buildPlugins ["lsp-trouble"]; + in + with pkgs.vimPlugins; + with plugins; [ + {plugin = editorconfig-nvim;} + {plugin = fugitive;} + {plugin = lsp-trouble;} + {plugin = nvim-autopairs;} + {plugin = rust-vim;} + {plugin = tabular;} + {plugin = vim-nix;} + {plugin = vim-repeat;} + {plugin = vimwiki;} - { - plugin = gitsigns-nvim; - config = "lua require 'gitsigns'.setup()"; - } + { + plugin = gitsigns-nvim; + config = "lua require 'gitsigns'.setup()"; + } - # TODO: replace with own bar - { - plugin = lightline-vim; - config = "let g:lightline = { 'colorscheme': 'solarized' }"; - } + # TODO: replace with own bar + { + plugin = lightline-vim; + config = "let g:lightline = { 'colorscheme': 'solarized' }"; + } - { - plugin = lspsaga-nvim; - # TODO: lspsaga config - } + { + plugin = lspsaga-nvim; + # TODO: lspsaga config + } - { - plugin = NeoSolarized; - config = '' - set background=light - colorscheme NeoSolarized - ''; - } + { + plugin = NeoSolarized; + config = '' + set background=light + colorscheme NeoSolarized + ''; + } - { - plugin = nvim-lspconfig; - # TODO: lspconfig config - } + { + plugin = nvim-lspconfig; + # TODO: lspconfig config + } - { - plugin = telescope-nvim; - # TODO: telescope-nvim config - } + { + plugin = telescope-nvim; + # TODO: telescope-nvim config + } - { - plugin = nvim-treesitter.withPlugins (plugins: - with plugins; [ - tree-sitter-bash - tree-sitter-bibtex - tree-sitter-c - tree-sitter-cmake - tree-sitter-comment - tree-sitter-cpp - tree-sitter-css - tree-sitter-devicetree - tree-sitter-dockerfile - tree-sitter-fennel - tree-sitter-go - tree-sitter-javascript - tree-sitter-json - tree-sitter-latex - tree-sitter-lua - tree-sitter-make - tree-sitter-markdown - tree-sitter-nix - tree-sitter-perl - tree-sitter-python - tree-sitter-regex - tree-sitter-rust - tree-sitter-toml - ]); - config = lib.concatStrings (lib.splitString "\n" '' - lua require 'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - } - ''); - } - ]; + { + plugin = nvim-treesitter.withPlugins (plugins: + with plugins; [ + tree-sitter-bash + tree-sitter-bibtex + tree-sitter-c + tree-sitter-cmake + tree-sitter-comment + tree-sitter-cpp + tree-sitter-css + tree-sitter-devicetree + tree-sitter-dockerfile + tree-sitter-fennel + tree-sitter-go + tree-sitter-javascript + tree-sitter-json + tree-sitter-latex + tree-sitter-lua + tree-sitter-make + tree-sitter-markdown + tree-sitter-nix + tree-sitter-perl + tree-sitter-python + tree-sitter-regex + tree-sitter-rust + tree-sitter-toml + ]); + config = lib.concatStrings (lib.splitString "\n" '' + lua require 'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + } + ''); + } + ]; }; }; }