TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.92k stars 176 forks source link

template include should be able to process recursive templates #406

Closed xenoterracide closed 2 years ago

xenoterracide commented 2 years ago

template included in template doesn't process

❯ cat alt/.zshrc\#\#template,e.zsh | clip
❯ cat extra/vim\#\#template,e.zsh | clip
❯ cat ~/.zshrc| clip
{% include "../extra/zshrc.os.{{ yadm.os }},e.zsh" %}
zi load z-shell/z-a-meta-plugins

zi for z-shell/history-search-multi-word z-shell/zconvey
zi snippet OMZL::history.zsh

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
zi load romkatv/powerlevel10k

zi wait for \
  OMZL::theme-and-appearance.zsh atload"unalias ls" \
  OMZP::colored-man-pages \
  OMZP::systemd \
  OMZP::direnv \
  OMZP::gitignore

zi ice wait as"program" has"perl" mv"cpanmin.us* -> cpanm" pick"cpanm"
zi snippet https://cpanmin.us

{% include "../extra/rc.sh" %}
{% include "../extra/alias.zsh" %}
{% include "../extra/vim##template,e.zsh" %}

zstyle :plugin:history-search-multi-word reset-prompt-protect 1

schedprompt() {
  zle && zle reset-prompt
  sched +1 schedprompt
}

zmodload -i zsh/sched
schedprompt

zi wait for \
  atinit"zicompinit; zicdreplay" \
      z-shell/fast-syntax-highlighting \
  atload"_zsh_autosuggest_start" \
      zsh-users/zsh-autosuggestions \
  blockf atpull'zi creinstall -q .' \
      zsh-users/zsh-completions

zi wait atload"zicompinit" for zsh-users+fast
set -o emacs
bindkey "^R" history-search-multi-word
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
function vim_setup() {
  local VIMDIR="$HOME/.vim"
  local VIM_COLOR="$VIMDIR/colors"
  local VIM_PACK="$VIMDIR/pack"
  local VIM_FTPLUGIN="$VIMDIR/ftplugin"
  local VIM_FTDETECT="$VIMDIR/ftdetect"
  local VIM_AFTER_SYNTAX="$VIMDIR/after/syntax"

  zi ice lucid wait cloneonly nocompile notify \
    atclone"install --compare -D colors/desertink.vim $VIM_COLOR/desertink.vim" \
    atpull"%atclone"
  zi light toupeira/vim-desertink

  zi ice lucid wait cloneonly nocompile \
    atclone"install -D after/syntax/zsh.vim $VIM_AFTER_SYNTAX/zsh.vim" \
    atpull"%atclone"
  zi light z-shell/zinit-vim-syntax

  zi ice lucid wait cloneonly nocompile \
    atclone"install -D syntax/systemd.vim $VIM_AFTER_SYNTAX/systemd.vim; install -D ftplugin/systemd.vim $VIM_FTPLUGIN/systemd.vim; install -D ftdetect/systemd.vim $VIM_FTDETECT/systemd.vim" \
    atpull"%atclone"
  zi light wgwoods/vim-systemd-syntax

{% if yadm.class == "cof" %}
{% else %}
  zi ice lucid wait cloneonly nocompile \
    atclone"rsync --mkpath --exclude '.*' --archive . $VIM_PACK/local/start/editorconfig" \
    atpull"%atclone"
  zi light editorconfig/editorconfig-vim
{% endif %}
}
vim_setup
unfunction vim_setup
######

yadm alt outputs

zi wait atload=". /opt/asdf-vm/asdf.sh" for z-shell/null
zi load z-shell/z-a-meta-plugins

zi for z-shell/history-search-multi-word z-shell/zconvey
zi snippet OMZL::history.zsh

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
zi load romkatv/powerlevel10k

zi wait for \
  OMZL::theme-and-appearance.zsh atload"unalias ls" \
  OMZP::colored-man-pages \
  OMZP::systemd \
  OMZP::direnv \
  OMZP::gitignore

zi ice wait as"program" has"perl" mv"cpanmin.us* -> cpanm" pick"cpanm"
zi snippet https://cpanmin.us

if [ "$DESKTOP_SESSION" = "gnome" ]; then
  eval $(gnome-keyring-daemon --start)
  if command -v seahorse > /dev/null 2>&1; then
    export SSH_ASKPASS=$(which seahorse)
    export SUDO_ASKPASS=$(which seahorse)
  fi
fi

if command -v perl >/dev/null 2>&1; then
  if perl -Mlocal::lib -e 1 >/dev/null 2>&1; then
    eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
  fi
fi

if command -v kubectl >/dev/null 2>&1; then
  source <(kubectl completion zsh)
fi

if command -v cargo >/dev/null 2>&1; then
  export PATH="$PATH:$HOME/.cargo/bin"
fi
alias vi="vim"
alias vim="\vim -Xp"
alias bfg="java -jar ~/.local/share/bfg.jar"
alias logs="journalctl --output cat --boot 0 --full"
alias dmesg="dmesg --color=always | less"
alias lsblk="lsblk -o name,label,fstype,uuid"

zi wait has"xclip" atload'alias xclip -selection clipboard -in' for z-shell/null
zi wait has"bat" atload'alias cat="bat --paging=never --plain"' for z-shell/null
zi wait has"exa" atload'alias ls="exa"' for z-shell/null
zi wait has"plocate" atload'alias locate="plocate"' for z-shell/null
zi wait has"dust" atload'alias dust="du"' for z-shell/null
zi wait has"kalker" atload'alias bc="kalker"' for z-shell/null
zi wait has"procs" atload'alias ps="procs"' for z-shell/null
zi wait has"tokei" atload'alias cloc="tokei"' for z-shell/null
zi wait has"zoxide" atinit'eval "$(zoxide init zsh --hook pwd --cmd cd)"' for z-shell/null
function vim_setup() {
  local VIMDIR="$HOME/.vim"
  local VIM_COLOR="$VIMDIR/colors"
  local VIM_PACK="$VIMDIR/pack"
  local VIM_FTPLUGIN="$VIMDIR/ftplugin"
  local VIM_FTDETECT="$VIMDIR/ftdetect"
  local VIM_AFTER_SYNTAX="$VIMDIR/after/syntax"

  zi ice lucid wait cloneonly nocompile notify \
    atclone"install --compare -D colors/desertink.vim $VIM_COLOR/desertink.vim" \
    atpull"%atclone"
  zi light toupeira/vim-desertink

  zi ice lucid wait cloneonly nocompile \
    atclone"install -D after/syntax/zsh.vim $VIM_AFTER_SYNTAX/zsh.vim" \
    atpull"%atclone"
  zi light z-shell/zinit-vim-syntax

  zi ice lucid wait cloneonly nocompile \
    atclone"install -D syntax/systemd.vim $VIM_AFTER_SYNTAX/systemd.vim; install -D ftplugin/systemd.vim $VIM_FTPLUGIN/systemd.vim; install -D ftdetect/systemd.vim $VIM_FTDETECT/systemd.vim" \
    atpull"%atclone"
  zi light wgwoods/vim-systemd-syntax

{% if yadm.class == "cof" %}
{% else %}
  zi ice lucid wait cloneonly nocompile \
    atclone"rsync --mkpath --exclude '.*' --archive . $VIM_PACK/local/start/editorconfig" \
    atpull"%atclone"
  zi light editorconfig/editorconfig-vim
{% endif %}
}
vim_setup
unfunction vim_setup
######

zstyle :plugin:history-search-multi-word reset-prompt-protect 1

schedprompt() {
  zle && zle reset-prompt
  sched +1 schedprompt
}

zmodload -i zsh/sched
schedprompt

zi wait for \
  atinit"zicompinit; zicdreplay" \
      z-shell/fast-syntax-highlighting \
  atload"_zsh_autosuggest_start" \
      zsh-users/zsh-autosuggestions \
  blockf atpull'zi creinstall -q .' \
      zsh-users/zsh-completions

zi wait atload"zicompinit" for zsh-users+fast
set -o emacs
bindkey "^R" history-search-multi-word
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
github-actions[bot] commented 2 years ago

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been labeled as stale for 7 days with no activity.