nushell: add some utilities

This commit is contained in:
LordMZTE 2024-05-21 23:14:18 +02:00
parent ed65d54832
commit 15658311ed
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 24 additions and 1 deletions

View file

@ -45,9 +45,31 @@ alias nv = nvim
alias nvide = & neovide "--no-fork"
# Misc functions
def --env mkdircd [p: string] {
mkdir $p
cd $p
}
def wldd [path: string] {
match (which $path) {
[{ path: $p }] => { ldd $p },
_ => { error make { msg: $"No external command ($path)" } },
}
}
def viewdoc [f: path] {
let inp = $f | path parse
match $inp.extension {
$e if $e in [ "doc", "docx", "odt", "ppt", "pptx", "odp" ] => {
let outp = { extension: "pdf", parent: "/tmp", stem: $inp.stem } | path join
libreoffice --convert-to pdf $f --outdir /tmp
try { zathura $outp }
rm $outp
},
"pdf" => { zathura $f },
"html" => { openbrowser $"file://($f | path expand)" }
$e if $e in [ "png", "webp", "jpg", "jpeg", "ff", "bmp" ] => { nsxiv $f },
_ => { mpv $f },
}
}

View file

@ -35,10 +35,11 @@ in
];
config.mzte-nix-packages = with pkgs; [
nix-output-monitor
nix-du
nix-output-monitor
nsxiv
nsxiv-pipe
nurl
(flakePkg "github:nix-community/zon2nix")
];