From 433c576a444b760bb27f12ad3b0e758153f79f0e Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 15 Apr 2023 17:45:49 -0500 Subject: [PATCH] refactor: Replace all shell command searching with Chezmoi searching --- dot_envvar.tmpl | 57 ++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/dot_envvar.tmpl b/dot_envvar.tmpl index 42346d3..206ff7b 100644 --- a/dot_envvar.tmpl +++ b/dot_envvar.tmpl @@ -1,45 +1,38 @@ +{{- if lookPath "pipx" }} # Enable pipx completions -if [ $(command -v pipx) ]; then - eval "$(register-python-argcomplete pipx)" -fi +eval "$(register-python-argcomplete pipx)" +{{- end }} +{{- if lookPath "nvim" }} # Preferred editor for local and remote sessions -if [ $(command -v nvim) ]; then - export EDITOR=nvim -elif [ $(command -v nano) ]; then - export EDITOR=nano -elif [ $(command -v vim) ]; then - export EDITOR=vim -elif [ $(command -v emacs) ]; then - export EDITOR='emacs -nw' -fi +export EDITOR=nvim +{{- end }} -if [ $(command -v kate) ]; then - export VISUAL=kate -elif [ $(command -v code) ]; then - export VISUAL=code -elif [ $(command -v emacs) ]; then - export VISUAL=emacs -fi +{{- if lookPath "kate" }} +export VISUAL=kate +{{- else if lookPath "codium" }} +export VISUAL=codium +{{- else if lookPath "code" }} +export VISUAL=code +{{- end }} +{{- if lookPath "most" }} # Set a cool new pager with color support -if [ $(command -v most) ]; then - export PAGER=most -fi - +export PAGER=most +{{- end }} +{{- if or (lookPath "bat") (lookPath "catbat") }} # Replace cat with bat -if [ $(command -v bat) ]; then - export BAT_PAGER="less -SRF" - export MANPAGER="sh -c 'col -bx | bat -l man -p'" - export MANROFFOPT="-c" -fi +export BAT_PAGER="less -SRF" +export MANPAGER="sh -c 'col -bx | bat -l man -p'" +export MANROFFOPT="-c" +{{- end }} # Add notification support for long-running processes -if [ $(command -v ntfy) ]; then - eval "$(ntfy shell-integration --longer-than 30)" - export AUTO_NTFY_DONE_IGNORE="vim nano emacs kate zshconfig screen tmux ssh top htop less more most nethogs 'singularity shell' julia man glances" -fi +{{- if lookPath "ntfy" }} +eval "$(ntfy shell-integration --longer-than 30)" +export AUTO_NTFY_DONE_IGNORE="vim nano emacs kate zshconfig screen tmux ssh top htop less more most nethogs 'singularity shell' julia man glances" +{{- end }} # Set the Nextflow enviroment caches export NXF_HOME="$HOME/.nextflow"