From 0c591c04359d0f7597b05bbbe7fd2b43c08d9ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 11 Aug 2023 18:59:52 +0200 Subject: [PATCH] feat(nvim): add hmts.nvim --- flake.lock | 17 +++++++++++++++++ flake.nix | 3 +++ modules/programs/fish.nix | 10 +++++----- modules/programs/nvim/default.nix | 12 +++--------- modules/programs/nvim/plugins/default.nix | 14 +++++++++----- overlays/vimPlugins.nix | 6 ++++++ 6 files changed, 43 insertions(+), 19 deletions(-) diff --git a/flake.lock b/flake.lock index b24bece..5d00940 100644 --- a/flake.lock +++ b/flake.lock @@ -319,6 +319,22 @@ "type": "github" } }, + "hmts-nvim": { + "flake": false, + "locked": { + "lastModified": 1691525513, + "narHash": "sha256-il5m+GlNt0FzZjefl1q8ZxWHg0+gQps0vigt+eoIy8A=", + "owner": "calops", + "repo": "hmts.nvim", + "rev": "594dd17c870afb7f6517723c8963f6eb144e3c0d", + "type": "github" + }, + "original": { + "owner": "calops", + "repo": "hmts.nvim", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -785,6 +801,7 @@ "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "flake-utils": "flake-utils", + "hmts-nvim": "hmts-nvim", "home-manager": "home-manager_2", "hypr-contrib": "hypr-contrib", "hyprland": "hyprland", diff --git a/flake.nix b/flake.nix index 724cd7c..88905ad 100644 --- a/flake.nix +++ b/flake.nix @@ -44,6 +44,9 @@ telekasten-nvim.flake = false; telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; + hmts-nvim.flake = false; + hmts-nvim.url = "github:calops/hmts.nvim"; + # Hyprland hypr-contrib.url = "github:hyprwm/contrib"; hyprland.url = "github:hyprwm/Hyprland"; diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index aac66b3..efc2dac 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -50,22 +50,22 @@ in ${exportedVariables} ''; functions = { - gi = with pkgs; '' + gi = '' set url https://www.gitignore.io/api if test (count $argv) -eq 0 set choice ( curl -sL $url/list \ | string split "," \ - | ${fzf}/bin/fzf -m \ + | ${getExe pkgs.fzf} -m \ | string join "," ) else set choice (string join "," $argv[1..]) end - if ${gum}/bin/gum confirm "Overwrite current .gitignore?" - ${curl}/bin/curl -sL $url/$choice > .gitignore + if ${getExe pkgs.gum} confirm "Overwrite current .gitignore?" + ${getExe pkgs.curl} -sL $url/$choice > .gitignore else - ${curl}/bin/curl -sL $url/$choice >> .gitignore + ${getExe pkgs.curl} -sL $url/$choice >> .gitignore end ''; fish_greeting = ""; diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 3503476..c7983f1 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -12,14 +12,8 @@ let id = x: x; listToString = sep: f: list: ''{ ${concatStringsSep sep (map f list)} }''; listToStringOneLine = listToString ", "; - listToStringMultiLine = listToString ",\n"; - keybinding = - { key - , cmd - , func - , mode - , desc - }: + listToStringMultiLine' = listToString ",\n" id; + keybinding = { key, cmd, func, mode, desc }: let cmdString = if cmd != null @@ -62,7 +56,7 @@ let ++ (optional (priority != null) "priority = ${toString priority}") ); lazySpecs = listToStringMultiLine id (map lazySpecFromPlugin cfg.plugins); - lazy = '' + lazy = /* lua */ '' require("lazy").setup(${lazySpecs}) ''; in diff --git a/modules/programs/nvim/plugins/default.nix b/modules/programs/nvim/plugins/default.nix index 6db0f7f..9d4c4fe 100644 --- a/modules/programs/nvim/plugins/default.nix +++ b/modules/programs/nvim/plugins/default.nix @@ -47,7 +47,7 @@ with builtins; { key = "st"; cmd = "TodoTelescope"; desc = "Todo"; } { key = "[q"; - func = ''function() + func = /* lua */ ''function() if require("trouble").is_open() then require("trouble").previous({ skip_groups = true, jump = true }) else @@ -58,7 +58,7 @@ with builtins; } { key = "]q"; - func = ''function() + func = /* lua */ ''function() if require("trouble").is_open() then require("trouble").next({ skip_groups = true, jump = true }) else @@ -200,7 +200,7 @@ with builtins; { plugin = comment-nvim; event = [ "BufReadPost" "BufNewFile" ]; - conf = '' + conf = /* lua */ '' require("Comment").setup() ''; } @@ -243,14 +243,14 @@ with builtins; { plugin = nvim-surround; event = [ "BufReadPost" "BufNewFile" ]; - conf = '' + conf = /* lua */ '' require("nvim-surround").setup({}) ''; } { plugin = nvim-treesitter-context; event = [ "BufReadPost" "BufNewFile" ]; - conf = '' + conf = /* lua */ '' require("treesitter-context").setup({}) ''; } @@ -258,5 +258,9 @@ with builtins; plugin = dressing-nvim; event = [ "VeryLazy" ]; } + { + plugin = hmts-nvim; + ft = [ "nix" ]; + } ]; } diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 5daec2e..eba8e54 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -21,5 +21,11 @@ with lib.my; version = mkVersionInput inputs.telekasten-nvim; src = inputs.telekasten-nvim; }; + + hmts-nvim = prev.vimUtils.buildVimPluginFrom2Nix { + pname = "hmts-nvim"; + version = mkVersionInput inputs.hmts-nvim; + src = inputs.hmts-nvim; + }; }; }