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

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
''