diff --git a/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl b/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl index e7d2da3..f7b5a75 100644 --- a/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl +++ b/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl @@ -112,6 +112,16 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} +{{- with $app_name := "bat" -}} +{{- with $repo := (printf "%s/%s" "sharkdp" $app_name) -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals (printf ".local/bin/%s" $app_name) (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/%s-%s-%s.tar.gz" $repo $version $app_name $version $myArch) + "path" (printf "%s-%s-%s/%s" $app_name $version $myArch $app_name) + "refreshPeriod" $defaultRefresh +) -}}{{- end -}}{{- end -}}{{- end -}} + {{/* # valid arch strings: # darwin_amd64 diff --git a/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzy_chezmoi.env.tmpl b/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzy_chezmoi.env.tmpl index d97634b..f99fc3b 100644 --- a/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzy_chezmoi.env.tmpl +++ b/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzy_chezmoi.env.tmpl @@ -24,6 +24,9 @@ if is_cmd 'chezmoi'; then ${SET_X:-:} +x } czcd() { chezmoi cd "${@}"; } + czgcd() { + cd "$(chezmoi git -- rev-parse --show-toplevel)${1:+/${1}}" + } czedext() { local CZ_EXT="$(find $(command chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')" CZ_EXT="${CZ_EXT:-$(chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}" diff --git a/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzz_aliases.env.tmpl b/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzz_aliases.env.tmpl index ebaa3ff..3af05a6 100644 --- a/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzz_aliases.env.tmpl +++ b/chezmoi.roots/_src.posix/private_dot_config/sz.env/zzz_aliases.env.tmpl @@ -18,12 +18,16 @@ alias lu='l -U ' alias sudo='sudo ' is_cmd ov \ -&& alias less="ov " \ -&& export PAGER=ov +&& alias less="ov --wrap=false " \ +&& export PAGER="ov --wrap=false " -is_cmd moar \ -&& alias less="moar " \ -&& export PAGER=moar +if is_cmd bat; then + alias cat='bat --wrap=never ' + alias less='cat ' +elif is_cmd moar; then + alias less="moar " \ + && export PAGER=moar +fi is_cmd nvim \ && export VISUAL="nvim" EDITOR="nvim" \ @@ -35,5 +39,11 @@ alias vim='nvim ' alias nvimdiff='nvim -d ' alias vimdiff='nvimdiff ' +if is_cmd git; then + gitcd() { + cd "$(git rev-parse --show-toplevel)${1:+/${1}}" + } +fi + # vim: set ft=sh expandtab tabstop=4 shiftwidth=4: diff --git a/chezmoi.roots/_src.posix/private_dot_local/bin/executable_load-zellij b/chezmoi.roots/_src.posix/private_dot_local/bin/executable_load-zellij index e45e967..c208693 100644 --- a/chezmoi.roots/_src.posix/private_dot_local/bin/executable_load-zellij +++ b/chezmoi.roots/_src.posix/private_dot_local/bin/executable_load-zellij @@ -66,6 +66,21 @@ ${SET_X-:} -x . <( env zellij setup --generate-completion "$BASE_SHELL" ) fi } + + zellij-mode() { + local BASE="config.kdl" ROOT=~/.config/zellij + local SRC="${BASE}.${1:?Mode missing}" + [[ -s "${ROOT}/${SRC}" ]] \ + || ( printf 'Mode "%s" must exists!\n' "${1}" >&2; return 1 ) + [[ -L "${ROOT}/${BASE}" || ! -e "${ROOT}/${BASE}" ]] \ + || ( printf 'config.kdl is an actual file, will not replace\n' >&2; return 2 ) + if [[ "$RESET" == 'reset' ]]; then + [[ -e "${ROOT}/${BASE}" ]] && rm "${ROOT}/${BASE}" + cp "${ROOT}/${SRC}" "${ROOT}/${BASE}" + else + (cd "${ROOT}"; ln -sf "${SRC}" "${BASE}") + fi + } ${SET_X-:} -x if [[ -n "$(env which zellij)" ]]; then zellij-load-completion