diff --git a/flake.lock b/flake.lock index 9ebdf3a..a7666f0 100755 --- a/flake.lock +++ b/flake.lock @@ -67,6 +67,22 @@ "type": "github" } }, + "microPlugins-vivify": { + "flake": false, + "locked": { + "lastModified": 1770382657, + "narHash": "sha256-yWmIgT90mC9PhzyH/itDbRMmRTiZiwW+Yo0dsHW7ni8=", + "ref": "refs/heads/main", + "rev": "3c5cb25facf3fc4143bfea9323a60eda65ef8485", + "revCount": 8, + "type": "git", + "url": "https://codeberg.org/gibbert/micro-vivify" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/gibbert/micro-vivify" + } + }, "nixos-grub-themes": { "inputs": { "nixpkgs": "nixpkgs" @@ -158,6 +174,7 @@ "inputs": { "caelestia-shell": "caelestia-shell", "home-manager": "home-manager", + "microPlugins-vivify": "microPlugins-vivify", "nixos-grub-themes": "nixos-grub-themes", "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" diff --git a/flake.nix b/flake.nix index e360572..3313439 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,10 @@ url = "github:caelestia-dots/shell"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; + microPlugins-vivify = { + url = "git+https://codeberg.org/gibbert/micro-vivify"; + flake = false; + }; }; # never got nixvim to wokrs. ): # nixvim = { diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index f3068ea..97c5d86 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -37,6 +37,8 @@ ../../modules/home-manager/thunderbird.nix # email client ../../modules/home-manager/eza.nix # ls replacement ../../modules/home-manager/vivify.nix # neovim markdown viewer (has also config for qutebrowser + #../../modules/home-manager/micro.nix # micro text editor. Not main editor (used for testing for notewrapper) + ../../modules/other/desktopEntries.nix # creates .desktop files ]; diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix new file mode 100644 index 0000000..1a4bc63 --- /dev/null +++ b/modules/home-manager/micro.nix @@ -0,0 +1,46 @@ +{ + config, + pkgs, + pkgs-unstable, + inputs, + ... +}: { + programs.micro = { + enable = true; + package = pkgs-unstable.micro-full; + settings = { + }; + }; + home.file.".config/micro/plug/vivify" = { + enable = true; + source = inputs.microPlugins-vivify; + recursive = true; + force = true; + }; + home.file.".config/micro/init.lua" = { + enable = true; + force = true; + text = '' +local buffer = import("micro/buffer") +local shell = import("micro/shell") + +function vivifyOpen(buf) + local cursor = buf:GetActiveCursor() + local line = cursor.Loc.Y + 1 + + shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line)) +end + +function onBufferOpen(buf) + if os.getenv("MICRO_VIVIFY") ~= "1" then + return + end + + -- only run for real files (not help/log/etc) + if buf.Type.Kind == buffer.BTDefault then + vivifyOpen(buf) + end +end +''; + }; +}