From a2e757440efcf494d647aba6426153eca6a562db Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 26 Sep 2024 01:05:51 +0300 Subject: [PATCH] ui/edgy-nvim: init --- flake.lock | 17 ++++++++++++ flake.nix | 5 ++++ modules/plugins/ui/default.nix | 1 + modules/plugins/ui/edgy-nvim/config.nix | 30 ++++++++++++++++++++++ modules/plugins/ui/edgy-nvim/default.nix | 6 +++++ modules/plugins/ui/edgy-nvim/edgy-nvim.nix | 21 +++++++++++++++ 6 files changed, 80 insertions(+) create mode 100644 modules/plugins/ui/edgy-nvim/config.nix create mode 100644 modules/plugins/ui/edgy-nvim/default.nix create mode 100644 modules/plugins/ui/edgy-nvim/edgy-nvim.nix diff --git a/flake.lock b/flake.lock index 91fc506..bed2a6f 100644 --- a/flake.lock +++ b/flake.lock @@ -508,6 +508,22 @@ "type": "github" } }, + "plugin-edgy-nvim": { + "flake": false, + "locked": { + "lastModified": 1725089082, + "narHash": "sha256-KP8lA+HU3xtX5gOigROva65bf7YH+12EVPM185riJTk=", + "owner": "folke", + "repo": "edgy.nvim", + "rev": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0", + "type": "github" + }, + "original": { + "owner": "folke", + "repo": "edgy.nvim", + "type": "github" + } + }, "plugin-elixir-tools": { "flake": false, "locked": { @@ -1807,6 +1823,7 @@ "plugin-diffview-nvim": "plugin-diffview-nvim", "plugin-dracula": "plugin-dracula", "plugin-dressing-nvim": "plugin-dressing-nvim", + "plugin-edgy-nvim": "plugin-edgy-nvim", "plugin-elixir-tools": "plugin-elixir-tools", "plugin-fastaction-nvim": "plugin-fastaction-nvim", "plugin-fidget-nvim": "plugin-fidget-nvim", diff --git a/flake.nix b/flake.nix index c4996fc..78be24e 100644 --- a/flake.nix +++ b/flake.nix @@ -565,6 +565,11 @@ flake = false; }; + plugin-edgy-nvim = { + url = "github:folke/edgy.nvim"; + flake = false; + }; + # Assistant plugin-chatgpt = { url = "github:jackMort/ChatGPT.nvim"; diff --git a/modules/plugins/ui/default.nix b/modules/plugins/ui/default.nix index 3407660..4ac511a 100644 --- a/modules/plugins/ui/default.nix +++ b/modules/plugins/ui/default.nix @@ -5,6 +5,7 @@ ./notifications ./smartcolumn ./colorizer + ./edgy-nvim ./illuminate ./breadcrumbs ./borders diff --git a/modules/plugins/ui/edgy-nvim/config.nix b/modules/plugins/ui/edgy-nvim/config.nix new file mode 100644 index 0000000..c1035bb --- /dev/null +++ b/modules/plugins/ui/edgy-nvim/config.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.strings) optionalString; + inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.ui.edgy-nvim; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = ["edgy-nvim"]; + pluginRC.edgy-nvim = entryBefore ["basic"] '' + ${optionalString cfg.setRecommendedNeovimOpts '' + -- Neovim options recommended by upstream. + -- Views can only be fully collapsed with the global statusline. + vim.o.laststatus = 3 + -- Default splitting will cause your main splits to jump when opening an edgebar. + -- To prevent this, set `splitkeep` to either `screen` or `topline`. + vim.o.splitkeep = "screen" + ''} + + require('edgy').setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/ui/edgy-nvim/default.nix b/modules/plugins/ui/edgy-nvim/default.nix new file mode 100644 index 0000000..20e07d5 --- /dev/null +++ b/modules/plugins/ui/edgy-nvim/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./edgy-nvim.nix + ./config.nix + ]; +} diff --git a/modules/plugins/ui/edgy-nvim/edgy-nvim.nix b/modules/plugins/ui/edgy-nvim/edgy-nvim.nix new file mode 100644 index 0000000..922d966 --- /dev/null +++ b/modules/plugins/ui/edgy-nvim/edgy-nvim.nix @@ -0,0 +1,21 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) bool; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.ui.edgy-nvim = { + enable = mkEnableOption "edgy.nvim for predefined window layouts"; + setRecommendedNeovimOpts = mkOption { + type = bool; + default = false; + description = '' + Whether nvf should set `vim.opt.laststatus` and `vim.opt.splitkeep` to + values recommended by upstream to ensure maximum compatibility. + ''; + }; + + setupOpts = mkPluginSetupOption "edgy" { + animate.enabled = mkEnableOption "animation support. Requires an animation library such as `mini.animate`"; + }; + }; +}