diff --git a/functions/main.zsh b/functions/main.zsh index a12dd93..4bd5003 100644 --- a/functions/main.zsh +++ b/functions/main.zsh @@ -10,7 +10,6 @@ finger() {command pinky $@} || finger() {command whoami} (($+commands[pandoc])) || pandoc() {command cat ${@[-1]}} (($+commands[grc])) || grc() {eval ${@[2,-1]}} -(($+commands[jq])) || jq() {echo ';'} (($+commands[git])) && git() { command git $@ | eval $(command git config --global pager.$1 || echo cat) diff --git a/sources/nix-env.zsh b/sources/nix-env.zsh index 2304323..459ec02 100644 --- a/sources/nix-env.zsh +++ b/sources/nix-env.zsh @@ -1,13 +1,18 @@ # :fzf-tab:complete:(\\|*/|)nix-env:* +(($+commands[jq])) && view_json() { + ${src:h:h}/bin/nix-env.jq | mdcat + } || view_json() { + bat --color=always -pljson + } + case $group in 'Attribute path') - nix-env -qa --out-path --json --meta -A $ctxt[hpre]$word | - ${src:h:h}/bin/nix-env.jq | mdcat + nix-env -qa --out-path --json --meta -A $ctxt[hpre]$word | view_json ;; 'Installed package'*) - nix-env -q --out-path --json --meta $word | ${src:h:h}/bin/nix-env.jq | mdcat + nix-env -q --out-path --json --meta $word | view_json ;; -'Local file') +'Store path to package') less $realpath ;; esac