feat(packages/edit): modify edit helper script
This commit is contained in:
parent
0b6426b2d4
commit
ec529f35a6
2 changed files with 13 additions and 1 deletions
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
home.shellAliases = {
|
home.shellAliases = {
|
||||||
v = "nvim";
|
v = "nvim";
|
||||||
edit = "nvim $(fzf)";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
fzf
|
fzf
|
||||||
devenv
|
devenv
|
||||||
pantheon.rebuild
|
pantheon.rebuild
|
||||||
|
pantheon.edit
|
||||||
];
|
];
|
||||||
|
|
||||||
home.persistence."/persist/home/rafiq".directories = [
|
home.persistence."/persist/home/rafiq".directories = [
|
||||||
|
|
12
packages/edit/default.nix
Normal file
12
packages/edit/default.nix
Normal 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
|
||||||
|
''
|
Loading…
Add table
Add a link
Reference in a new issue