From a4277829ad9f2312c3d4cb814136c5ac35da52a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 10 Aug 2024 14:38:01 +0200 Subject: [PATCH 1/2] [feat] nvim: add custom vim plugin management Use vimPluginsUpdater to keep extra plugins up to date Fixes #4 --- justfile | 19 ++++++++++++++ nvim/extraPlugins/default.nix | 10 +++++-- nvim/extraPlugins/generated.nix | 35 +++++++++++++++++++++++++ nvim/extraPlugins/nvim-silicon.nix | 10 ------- nvim/extraPlugins/plugins | 3 +++ nvim/extraPlugins/vim-jjdescription.nix | 10 ------- 6 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 nvim/extraPlugins/generated.nix delete mode 100644 nvim/extraPlugins/nvim-silicon.nix create mode 100644 nvim/extraPlugins/plugins delete mode 100644 nvim/extraPlugins/vim-jjdescription.nix diff --git a/justfile b/justfile index 8261c08..d58e075 100644 --- a/justfile +++ b/justfile @@ -11,6 +11,25 @@ build-vm: run-vm: build-vm QEMU_OPTS="$QEMU_OPTS_WL" result/bin/run-nixos-vm +update-vim-plugins: + #!/bin/sh + # Use local nixpkgs if available + nixpkgs="$HOME/Dev/nixpkgs" + # copy nixpkgs from local checkout + if [ ! -d "$nixpkgs" ]; then + nixpkgs="$(mktemp -d)" + cp -r /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/. "$nixpkgs" + cd "$nixpkgs" + git init . + git add . + git commit -m 'dummy commit' + cd - + fi + # update vim plugins + nix run nixpkgs#vimPluginsUpdater -- --nixpkgs "$nixpkgs" --no-commit -i ./nvim/extraPlugins/plugins -o ./nvim/extraPlugins/generated.nix update + # format the generated output + nix fmt ./nvim/extraPlugins/generated.nix + # Amend Update flake.lock PR flake-pr: git branch -D update_flake_lock_action || echo "no previous update branch" diff --git a/nvim/extraPlugins/default.nix b/nvim/extraPlugins/default.nix index 7413347..a57ff4b 100644 --- a/nvim/extraPlugins/default.nix +++ b/nvim/extraPlugins/default.nix @@ -1,5 +1,11 @@ { pkgs }: +let + overlay = pkgs.callPackage ./generated.nix { + inherit (pkgs.vimUtils) buildVimPlugin buildNeovimPlugin; + }; + plugins = overlay pkgs pkgs; +in { - vim-jjdescription = pkgs.callPackage ./vim-jjdescription.nix { }; - nvim-silicon = pkgs.callPackage ./nvim-silicon.nix { }; + inherit overlay; + inherit (plugins) vim-jjdescription nvim-silicon; } diff --git a/nvim/extraPlugins/generated.nix b/nvim/extraPlugins/generated.nix new file mode 100644 index 0000000..9771550 --- /dev/null +++ b/nvim/extraPlugins/generated.nix @@ -0,0 +1,35 @@ +# GENERATED by ./pkgs/applications/editors/vim/plugins/update.py. Do not edit! +{ + lib, + buildVimPlugin, + buildNeovimPlugin, + fetchFromGitHub, + fetchgit, +}: + +final: prev: { + nvim-silicon = buildVimPlugin { + pname = "nvim-silicon"; + version = "2024-07-30"; + src = fetchFromGitHub { + owner = "michaelrommel"; + repo = "nvim-silicon"; + rev = "feb882f04c992b797daa118101a239fb3bedfc04"; + sha256 = "03dy4q2dbgiyydi9wvpij6s2aggdpr3lgd9cqqv0i2m1m0qb9gad"; + }; + meta.homepage = "https://github.com/michaelrommel/nvim-silicon/"; + }; + + vim-jjdescription = buildVimPlugin { + pname = "vim-jjdescription"; + version = "2024-05-28"; + src = fetchFromGitHub { + owner = "avm99963"; + repo = "vim-jjdescription"; + rev = "ca14325202f3cd894d01ba833451017624249222"; + sha256 = "1y83fdih991ivlvgcwp0sx97icmf9k6px7mr26vb77izjlf011w2"; + }; + meta.homepage = "https://github.com/avm99963/vim-jjdescription/"; + }; + +} diff --git a/nvim/extraPlugins/nvim-silicon.nix b/nvim/extraPlugins/nvim-silicon.nix deleted file mode 100644 index bcde742..0000000 --- a/nvim/extraPlugins/nvim-silicon.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ vimUtils, fetchFromGitHub }: -vimUtils.buildVimPlugin { - name = "nvim-silicon"; - src = fetchFromGitHub { - owner = "michaelrommel"; - repo = "nvim-silicon"; - rev = "v1.0.0"; - hash = "sha256-cZOzgzLUNC9qOS2m/rc6YJfpNGdRTSCAdEPQDy+wT6I="; - }; -} diff --git a/nvim/extraPlugins/plugins b/nvim/extraPlugins/plugins new file mode 100644 index 0000000..eacb0e5 --- /dev/null +++ b/nvim/extraPlugins/plugins @@ -0,0 +1,3 @@ +repo,branch,alias +https://github.com/michaelrommel/nvim-silicon/,, +https://github.com/avm99963/vim-jjdescription/,, diff --git a/nvim/extraPlugins/vim-jjdescription.nix b/nvim/extraPlugins/vim-jjdescription.nix deleted file mode 100644 index 1c69502..0000000 --- a/nvim/extraPlugins/vim-jjdescription.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ vimUtils, fetchFromGitHub }: -vimUtils.buildVimPlugin { - name = "jjdescription"; - src = fetchFromGitHub { - owner = "avm99963"; - repo = "vim-jjdescription"; - rev = "c9bf9f849ead3961ae38ab33f68306996e64c6e8"; - hash = "sha256-qnZFuXbzpm2GN/+CfksFfW2O+qTosUZcUagqCTzmtWo="; - }; -} -- 2.47.0 From 09f35f51256ecde7285de572454c87b184da710a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 10 Aug 2024 14:50:17 +0200 Subject: [PATCH 2/2] [fix] nvim: luasnip settings changed --- nvim/plugins.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nvim/plugins.nix b/nvim/plugins.nix index 9df1d6b..3e76f45 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -209,9 +209,7 @@ in }; luasnip = { enable = true; - extraConfig = { - update_events = "TextChanged,TextChangedI"; - }; + settings.update_events = "TextChanged,TextChangedI"; }; noice = { enable = true; -- 2.47.0