feat(packages/edit): modify edit helper script

This commit is contained in:
Mohammad Rafiq 2025-05-20 13:41:06 +08:00
parent 0b6426b2d4
commit ec529f35a6
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View file

@ -15,7 +15,6 @@
home.shellAliases = {
v = "nvim";
edit = "nvim $(fzf)";
};
home.packages = with pkgs; [
@ -23,6 +22,7 @@
fzf
devenv
pantheon.rebuild
pantheon.edit
];
home.persistence."/persist/home/rafiq".directories = [

12
packages/edit/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
let
finder = "${pkgs.fzf}/bin/fzf --preview 'cat {}'";
in
pkgs.writeShellScriptBin "edit" # sh
''
if [ $# -gt 0 ]; then
$EDITOR $(${finder} -q $*)
else
$EDITOR $(${finder})
fi
''