From 63ec52e5727a3d151a6eb6e9b9c6f6cce13b4d28 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sat, 9 Apr 2022 17:39:52 +0200 Subject: [PATCH] nvim: Dependency and configuration updates --- config/nvim/nifoc/diagnostic.fnl | 3 +- config/nvim/plugins/cmp.fnl | 10 ++-- config/nvim/plugins/lsp.fnl | 6 +- config/nvim/plugins/null-ls.fnl | 3 + config/nvim/plugins/treesitter.fnl | 34 ++++++++++- flake.lock | 24 ++++---- programs/nvim/default.nix | 5 +- programs/nvim/plugins.nix | 92 +++++++++++++++--------------- programs/nvim/plugins.yaml | 4 +- programs/nvim/update-plugins.sh | 6 +- programs/nvim/update-shell.nix | 1 + 11 files changed, 111 insertions(+), 77 deletions(-) diff --git a/config/nvim/nifoc/diagnostic.fnl b/config/nvim/nifoc/diagnostic.fnl index 92f0f4a..ac78050 100644 --- a/config/nvim/nifoc/diagnostic.fnl +++ b/config/nvim/nifoc/diagnostic.fnl @@ -19,8 +19,7 @@ (keymap.lsp-attach client bufnr))) (fn mod.maybe-enable-fixer [client bufnr] - (when (and client.resolved_capabilities.document_formatting - (= vim.b.nifoc_fixer_enabled nil)) + (when client.resolved_capabilities.document_formatting (api.nvim_buf_set_var bufnr :nifoc_fixer_enabled 1) (lsp-format.on_attach client bufnr))) diff --git a/config/nvim/plugins/cmp.fnl b/config/nvim/plugins/cmp.fnl index e7b534a..ba4dd0c 100644 --- a/config/nvim/plugins/cmp.fnl +++ b/config/nvim/plugins/cmp.fnl @@ -1,5 +1,5 @@ (let [cmp (require :cmp) - luasnip (require :luasnip) + snippy (require :snippy) lspkind (require :lspkind) npairs (require :nvim-autopairs.completion.cmp)] (fn has-words-before? [] @@ -12,17 +12,17 @@ (fn map-tab [fallback] (if (cmp.visible) (cmp.select_next_item) - (luasnip.expand_or_jumpable) (luasnip.expand_or_jump) + (snippy.can_expand_or_advance) (snippy.expand_or_advance) (has-words-before?) (cmp.complete) (fallback))) (fn map-stab [fallback] (if (cmp.visible) (cmp.select_prev_item) - (luasnip.jumpable -1) (luasnip.jump -1) + (snippy.can_jump -1) (snippy.previous) (fallback))) (cmp.setup {:sources (cmp.config.sources [{:name :nvim_lsp} - {:name :luasnip} + {:name :snippy} {:name :nvim_lua}] [{:name :treesitter} {:name :buffer} @@ -52,7 +52,7 @@ "─" "╰" "│"]} - :snippet {:expand #(luasnip.lsp_expand $1.body)} + :snippet {:expand #(snippy.expand_snippet $1.body)} :formatting {:format (lspkind.cmp_format)}}) (cmp.setup.cmdline "/" {:sources (cmp.config.sources [{:name :nvim_lsp_document_symbol}] diff --git a/config/nvim/plugins/lsp.fnl b/config/nvim/plugins/lsp.fnl index bd44a86..d21c561 100644 --- a/config/nvim/plugins/lsp.fnl +++ b/config/nvim/plugins/lsp.fnl @@ -23,6 +23,9 @@ :show_filename false :diagnostics false}) (lsp-status.register_progress) + ;; Custom handler + (tset vim.lsp.handlers "textDocument/hover" (vim.lsp.with vim.lsp.handlers.hover {:border "rounded"})) + (tset vim.lsp.handlers "textDocument/signatureHelp" (vim.lsp.with vim.lsp.handlers.signature_help {:border "rounded"})) ;; Servers (let [default-capabilities (vim.lsp.protocol.make_client_capabilities) capabilities (vim.tbl_extend :keep @@ -30,6 +33,7 @@ lsp-status.capabilities) flags {:allow_incremental_sync true :debounce_text_changes 700} default-config {:on_attach custom-attach : capabilities : flags} + default-config-no-format {:on_attach custom-attach-no-format : capabilities : flags} default-servers [:bashls :cssls :dockerls @@ -45,7 +49,7 @@ ((. lsp name :setup) default-config)) ;; Custom (lsp.elixirls.setup (->> {:cmd [:elixir-ls]} - (vim.tbl_extend :force default-config))) + (vim.tbl_extend :force default-config-no-format))) (lsp.tsserver.setup (->> {:cmd [:typescript-language-server :--stdio :--tsserver-path diff --git a/config/nvim/plugins/null-ls.fnl b/config/nvim/plugins/null-ls.fnl index 9d8e598..9a86283 100644 --- a/config/nvim/plugins/null-ls.fnl +++ b/config/nvim/plugins/null-ls.fnl @@ -5,10 +5,13 @@ :sources [; Formatting builtins.formatting.fish_indent builtins.formatting.fnlfmt + builtins.formatting.mix (builtins.formatting.shfmt.with {:extra_args [:-i :2]}) ; Diagnostics builtins.diagnostics.credo + builtins.diagnostics.deadnix + builtins.diagnostics.fish builtins.diagnostics.hadolint (builtins.diagnostics.shellcheck.with {:extra_args [:-f :gcc diff --git a/config/nvim/plugins/treesitter.fnl b/config/nvim/plugins/treesitter.fnl index 0c0a7b9..3481df6 100644 --- a/config/nvim/plugins/treesitter.fnl +++ b/config/nvim/plugins/treesitter.fnl @@ -2,6 +2,35 @@ treesitter-config (require :nvim-treesitter.configs) treesitter-parsers (require :nvim-treesitter.parsers) set-bufvar vim.api.nvim_buf_set_var + install-parsers [:bash + :comment + :css + :dockerfile + :eex + :elixir + :erlang + :fennel + :fish + :heex + :help + :html + :http + :javascript + :jsdoc + :json + :lua + :make + :nix + :query + :regex + :ruby + :scss + :svelte + :toml + :tsx + :typescript + :vim + :yaml] rainbow-parsers [:fennel]] (treesitter.define_modules {:nifoc_hooks {:enable false :attach (lambda [bufnr] @@ -13,7 +42,8 @@ :nifoc_treesitter_enabled 0)) :is_supported #true}}) - (treesitter-config.setup {:ensure_installed :maintained + (treesitter-config.setup {:ensure_installed install-parsers + :sync_install true :highlight {:enable true} :indent {:enable true} :textobjects {:select {:enable true @@ -25,7 +55,7 @@ :disable (vim.tbl_filter (fn [parser] (not (vim.tbl_contains rainbow-parsers parser))) - (treesitter-parsers.available_parsers))} + install-parsers)} :matchup {:enable true} :autopairs {:enable true} :autotag {:enable true} diff --git a/flake.lock b/flake.lock index 62e2945..5064425 100644 --- a/flake.lock +++ b/flake.lock @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1649352994, - "narHash": "sha256-vTHLgqyAUrtIzw/wbOrfqzf20/UuspDRhurj8LbcSWs=", + "lastModified": 1649392573, + "narHash": "sha256-dCPEJZzExz2+i7AjUuViZUgHC+JXDlBBG/IzuSYWCh8=", "owner": "nix-community", "repo": "home-manager", - "rev": "3071ea205da9ad7dd1c4094c2076d44f88ba350e", + "rev": "f911ebbec927e8e9b582f2e32e2b35f730074cfc", "type": "github" }, "original": { @@ -96,11 +96,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1649315348, - "narHash": "sha256-CBOHj+Ty54uX3ajqyFTBoGzkae895Y4/XnvSvn9eP4s=", + "lastModified": 1649482302, + "narHash": "sha256-HkTfLdRpi3ec+WJNRUSWZjwHxD+abwnDkegfTedzTJ8=", "owner": "neovim", "repo": "neovim", - "rev": "f85f4e25d2d5edf46fcb950ced028685fe95a7d7", + "rev": "fda9adab5d0688fbd94544dc7146d0957c728c69", "type": "github" }, "original": { @@ -119,11 +119,11 @@ ] }, "locked": { - "lastModified": 1649319653, - "narHash": "sha256-vyBOEWQ9GUcr4TW4eG9l49fRd/WlHMOeGYTKh8G9h54=", + "lastModified": 1649492070, + "narHash": "sha256-xBIW4qE5F8U52MFo3t901Sg53wmffS0gdewefwlVFJE=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "c477db087ff6a092e07f9754dedb256888cbcc41", + "rev": "c67abbadead972871a2d39122600235b3ce287b3", "type": "github" }, "original": { @@ -186,11 +186,11 @@ ] }, "locked": { - "lastModified": 1649291966, - "narHash": "sha256-52a+0KKH7UaWSOZoRvaQFIjfFsxixpMP8grCR+FY58g=", + "lastModified": 1649464633, + "narHash": "sha256-4Su2Mdb0V4Gf5QJayOBqThWevNMBEtB1ZihbC8ixs54=", "owner": "arqv", "repo": "zig-overlay", - "rev": "5512b6e9c793444ae5abe50e2095fd32f251141c", + "rev": "4eca4af2446545ea066f1d0f2022d00073c0c57a", "type": "github" }, "original": { diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index 9fe4125..98be434 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -47,6 +47,7 @@ in taplo-lsp # LSP Tools + deadnix hadolint fnlfmt shellcheck @@ -151,8 +152,8 @@ in cmp-nvim-lsp cmp-nvim-lsp-signature-help - LuaSnip - cmp_luasnip + nvim-snippy + cmp-snippy cmp-nvim-lua cmp-path cmp-buffer diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 189580e..07068ef 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -27,12 +27,12 @@ }; plenary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "plenary.nvim"; - version = "1649311285"; + version = "1649500938"; src = pkgs.fetchFromGitHub { owner = "nvim-lua"; repo = "plenary.nvim"; - rev = "470d0e84ae275a367892e277df770233ec477f46"; - sha256 = "xrh7yNH0WMN+rhwnagx4VaCkqy5kL7Ghpm5I7/4zuls="; + rev = "c54f77d409f476d457d1e1ba7615139c63937321"; + sha256 = "t7IrCd9VKBYVr1xzGrQt6S8vhjG+TGGf6+YJn/Svl9s="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-lua/plenary.nvim"; @@ -87,12 +87,12 @@ }; leap-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "leap.nvim"; - version = "1649262387"; + version = "1649451840"; src = pkgs.fetchFromGitHub { owner = "ggandor"; repo = "leap.nvim"; - rev = "36c4037c5e02d02bf9e49dbb822ada3035c41c35"; - sha256 = "T7r9kqGCMlAgUdCS9WJfBR63i2lkuQ2N0unIgBBz2QE="; + rev = "b0e30cc1905a40ea8759286bc14061ce585ccbb4"; + sha256 = "7JzXUlmwn7hDFS38/3MzNnPZ44SkUkIMGpOHM8heos8="; fetchSubmodules = true; }; meta.homepage = "https://github.com/ggandor/leap.nvim"; @@ -111,48 +111,48 @@ }; nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter"; - version = "1649347938"; + version = "1649507047"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "0373e2ae5f47023b687dc7c84a2ce2aaff7110ba"; - sha256 = "f4hjBHhz8+4ZkzEbQaOPa1cD8jQqt8CVg+NhKFZs7XY="; + rev = "e3adb39586ef573fc048aeb341f3a9fb71754452"; + sha256 = "oVXJzI+ZqPJOn1SywI0EnkcsDcDq0qICZYip53055fw="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter"; }; nvim-ts-rainbow = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-ts-rainbow"; - version = "1648928541"; + version = "1649434846"; src = pkgs.fetchFromGitHub { owner = "p00f"; repo = "nvim-ts-rainbow"; - rev = "dee11b86ae2419e3f7484197c597a0e634a37a56"; - sha256 = "/qKBx3P115rk0kbvwdYXriGplNtD88cUJVGS3itFu+Y="; + rev = "5ad21bffe98f0b42d8225553d1a800b05f9f1eee"; + sha256 = "69MdMizzy7BYpsXcPmyZlGP0zAWvAVnLK3w0AEy71ws="; fetchSubmodules = true; }; meta.homepage = "https://github.com/p00f/nvim-ts-rainbow"; }; playground = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "playground"; - version = "1648628752"; + version = "1649436240"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "playground"; - rev = "7dbcd4d647010a80d135804b3fc1da3fb77083d6"; - sha256 = "x6NKZNJzGDnpMI97ChhG+DBJPUwLMWjXyhmAugXH+Tw="; + rev = "13e2d2d63ce7bc5d875e8bdf89cb070bc8cc7a00"; + sha256 = "2gKGDUvEVCVOX1hbnc4WDlcjsE8YnhrTMqv6POx4k84="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-treesitter/playground"; }; telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "telescope.nvim"; - version = "1648985613"; + version = "1649503077"; src = pkgs.fetchFromGitHub { owner = "nvim-telescope"; repo = "telescope.nvim"; - rev = "6e7ee3829225d5c97c1ebfff686050142ffe5867"; - sha256 = "iinltnvBuJMf8tgAF/9UIkFaEwx/d2lFJ0oSSuUwm2I="; + rev = "762d49f60749eac75979202194ad0ee177977a74"; + sha256 = "lmXzbwYKtkhmSibe2mOOJTdmf0CL2UgZz52luMxPjMU="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-telescope/telescope.nvim"; @@ -202,12 +202,12 @@ }; null-ls-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "null-ls.nvim"; - version = "1649291669"; + version = "1649387867"; src = pkgs.fetchFromGitHub { owner = "jose-elias-alvarez"; repo = "null-ls.nvim"; - rev = "64d9e2b58a17cd85138c265ab816198000e126d2"; - sha256 = "QGsLOUjPXSv6feHR46KpYGe4d/kCf+8Qqg4RCBbTTts="; + rev = "8d239816a88a8ea5472b43d33abb4c27e63e314d"; + sha256 = "irUdHReYYM9RB/FhITunYzhxU2MevxNKpv8CNZQQrUk="; fetchSubmodules = true; }; meta.homepage = "https://github.com/jose-elias-alvarez/null-ls.nvim"; @@ -238,12 +238,12 @@ }; nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-cmp"; - version = "1649208788"; + version = "1649429970"; src = pkgs.fetchFromGitHub { owner = "hrsh7th"; repo = "nvim-cmp"; - rev = "27970d8a1c99cd6ddea2709beda52d8e9336228b"; - sha256 = "Yvw5GXNrxFl8YNILNyAirqbTWxxEjgVbkeU7L5WodbY="; + rev = "3192a0c57837c1ec5bf298e4f3ec984c7d2d60c0"; + sha256 = "IhFrjPZ2w6bEgGIS2jljlUvYsvmOPdjcK0m6+lsP/oQ="; fetchSubmodules = true; }; meta.homepage = "https://github.com/hrsh7th/nvim-cmp"; @@ -272,29 +272,29 @@ }; meta.homepage = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"; }; - LuaSnip = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "LuaSnip"; - version = "1649161648"; + nvim-snippy = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "nvim-snippy"; + version = "1649459870"; src = pkgs.fetchFromGitHub { - owner = "L3MON4D3"; - repo = "LuaSnip"; - rev = "69cb81cf7490666890545fef905d31a414edc15b"; - sha256 = "aEkDqez8xUpikaq+LI7Rmx+xk24wmlGmibnDKSk3SLY="; + owner = "dcampos"; + repo = "nvim-snippy"; + rev = "ce55224f5b9a9eba8c21ac7d66aeb75b2d071bcf"; + sha256 = "kjstrRqU1xyY0HOXmD6EcOQP0FZtsh/zbb6pdjYSCU0="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/L3MON4D3/LuaSnip"; + meta.homepage = "https://github.com/dcampos/nvim-snippy"; }; - cmp_luasnip = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "cmp_luasnip"; - version = "1648846007"; + cmp-snippy = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "cmp-snippy"; + version = "1632148155"; src = pkgs.fetchFromGitHub { - owner = "saadparwaiz1"; - repo = "cmp_luasnip"; - rev = "b10829736542e7cc9291e60bab134df1273165c9"; - sha256 = "1JiDa7fK9AEMUxLOFD3SSsxKEVLfd5xR8vfUlLRqz+M="; + owner = "dcampos"; + repo = "cmp-snippy"; + rev = "9af1635fe40385ffa3dabf322039cb5ae1fd7d35"; + sha256 = "vseoNZtB8jPGAJD8zFJigwKn11rXsNy04ipg0fYM46k="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/saadparwaiz1/cmp_luasnip"; + meta.homepage = "https://github.com/dcampos/cmp-snippy"; }; cmp-nvim-lua = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "cmp-nvim-lua"; @@ -394,12 +394,12 @@ }; nvim-treesitter-textobjects = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter-textobjects"; - version = "1648520193"; + version = "1649462894"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter-textobjects"; - rev = "c4b41e42dad700b23c6ea86ecb69c9deb55a8fbb"; - sha256 = "7G9vmmO3N0J7WdnSR3nwXt1xnEbj+kqv2i76nYNdDtE="; + rev = "f85c66102f91da02569af0937601ee40c7a19dbd"; + sha256 = "RNEyiieaAFHhyj1UmmQTqST/1UyEubJ/V8FnQKFVAKE="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"; @@ -478,12 +478,12 @@ }; gitsigns-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "gitsigns.nvim"; - version = "1648922715"; + version = "1649489011"; src = pkgs.fetchFromGitHub { owner = "lewis6991"; repo = "gitsigns.nvim"; - rev = "83ab3ca26ff5038f823060dfddda7a053e579b67"; - sha256 = "9++DoH1AiHuyv8N5aQ3Xob8bKiswWQfgISfxkK2ZP8M="; + rev = "acdd74bc6cc88afffe2586e2b8ec8e7746d9acc9"; + sha256 = "koF8aynAaDOr+Gp+6NvrgaDLHeiMuKJKbCuNqeXwv08="; fetchSubmodules = true; }; meta.homepage = "https://github.com/lewis6991/gitsigns.nvim"; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml index 4437ace..9c3cbb9 100644 --- a/programs/nvim/plugins.yaml +++ b/programs/nvim/plugins.yaml @@ -43,8 +43,8 @@ - src: hrsh7th/nvim-cmp - src: hrsh7th/cmp-nvim-lsp - src: hrsh7th/cmp-nvim-lsp-signature-help -- src: L3MON4D3/LuaSnip -- src: saadparwaiz1/cmp_luasnip +- src: dcampos/nvim-snippy +- src: dcampos/cmp-snippy - src: hrsh7th/cmp-nvim-lua - src: hrsh7th/cmp-path - src: hrsh7th/cmp-buffer diff --git a/programs/nvim/update-plugins.sh b/programs/nvim/update-plugins.sh index 9128519..ac6539d 100755 --- a/programs/nvim/update-plugins.sh +++ b/programs/nvim/update-plugins.sh @@ -85,11 +85,7 @@ nixpkgs-fmt "$nix_new_file" if test -f "$nix_file"; then set +eo pipefail - if [ "$TERM" = "xterm-kitty" ]; then - kitty +kitten diff "$nix_file" "$nix_new_file" - else - diff -U 2 "$nix_file" "$nix_new_file" | bat --paging=never -ldiff - fi + difft "$nix_file" "$nix_new_file" set -eo pipefail mv "$nix_new_file" "$nix_file" diff --git a/programs/nvim/update-shell.nix b/programs/nvim/update-shell.nix index eb72678..5366e5c 100644 --- a/programs/nvim/update-shell.nix +++ b/programs/nvim/update-shell.nix @@ -6,6 +6,7 @@ mkShell { bat curl dasel + difftastic jq nix-prefetch-github nixpkgs-fmt