From 84a09058d0724841bd2691654d15513fd5b22908 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sat, 27 May 2023 20:54:07 -0700 Subject: [PATCH] Add delimiter template directives to avoid syntax errors --- dot_bashrc.tmpl | 12 ++-- dot_config/bash/bashrc.d/base.sh.tmpl | 18 +++--- dot_config/bash/bashrc.d/completion.sh.tmpl | 56 +++++++++---------- dot_config/bash/env.d/base.env.tmpl | 9 +++ dot_config/bash/env.d/bash.env | 3 - dot_config/bash/env.d/darwin.env.tmpl | 4 -- dot_config/bash/prompt.sh.tmpl | 17 +++--- .../fish/completions/completions.fish.tmpl | 10 ++-- dot_config/git/config.tmpl | 21 +++---- dot_config/git/ignore.tmpl | 6 +- .../hooks/executable_prepare-commit-msg.tmpl | 8 ++- dot_config/i3/config.tmpl | 6 +- dot_config/i3status/config.tmpl | 6 +- dot_config/lf/lfrc.tmpl | 11 ++-- dot_config/profile/env.d/base.env.tmpl | 35 ++++++------ dot_config/profile/profile.d/alias.sh.tmpl | 20 +++---- dot_config/profile/profile.d/go.sh.tmpl | 10 ++-- .../profile/profile.d/hellotech.sh.tmpl | 8 +-- dot_config/profile/profile.d/ruby.sh.tmpl | 10 ++-- dot_config/profile/profile.d/rust.sh.tmpl | 8 +-- dot_config/starship.toml.tmpl | 6 +- dot_config/systemd/user/podman.service.tmpl | 9 ++- .../executable_macos-color-workaround.tmpl | 6 +- dot_config/tmux/tmux.conf.tmpl | 10 ++-- dot_config/user-dirs.dirs.tmpl | 12 ++-- dot_config/vim/ftplugin/go.vim.tmpl | 12 ++-- dot_config/vim/ftplugin/rust.vim.tmpl | 6 +- dot_config/vim/plug.d/fzf.vim.tmpl | 6 +- dot_config/vim/plug.d/go.vim.tmpl | 6 +- dot_config/vim/plug.d/rust.vim.tmpl | 6 +- dot_config/vim/snips/go.snippets.tmpl | 6 +- dot_config/zsh/zshrc.d/base.zsh.tmpl | 44 +++++++-------- dot_jq/colors.jq.tmpl | 6 +- dot_jq/env.jq.tmpl | 6 +- dot_jq/github.jq.tmpl | 6 +- dot_jq/ht.jq.tmpl | 6 +- 36 files changed, 239 insertions(+), 192 deletions(-) create mode 100644 dot_config/bash/env.d/base.env.tmpl delete mode 100644 dot_config/bash/env.d/bash.env delete mode 100644 dot_config/bash/env.d/darwin.env.tmpl diff --git a/dot_bashrc.tmpl b/dot_bashrc.tmpl index 05c095b..6e6bd79 100644 --- a/dot_bashrc.tmpl +++ b/dot_bashrc.tmpl @@ -1,22 +1,24 @@ #!/usr/bin/env bash +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=bash */}} -. "${HOME}/.profile" +source "${HOME}/.profile" # if not running interactively, don't do anything more [ -z "$PS1" ] && return -{{- if not (lookPath "starship") }} +#{{- if not (lookPath "starship") }} if [[ -f "${XDG_CONFIG_HOME}/bash/prompt.sh" ]]; then # shellcheck disable=SC1090 source "${XDG_CONFIG_HOME}/bash/prompt.sh" fi -{{- end }} +#{{- end }} if [ -d "${XDG_CONFIG_HOME}"/bash/bashrc.d ]; then for file in "${XDG_CONFIG_HOME}"/bash/bashrc.d/*.sh; do if [ -r "$file" ]; then #shellcheck disable=1090 - . "$file" + source "$file" fi done fi @@ -31,5 +33,3 @@ if [[ -d "${XDG_CONFIG_HOME}/bash/env.d" ]]; then )" done fi - -# vim: ft=bash diff --git a/dot_config/bash/bashrc.d/base.sh.tmpl b/dot_config/bash/bashrc.d/base.sh.tmpl index cf54301..64c877e 100644 --- a/dot_config/bash/bashrc.d/base.sh.tmpl +++ b/dot_config/bash/bashrc.d/base.sh.tmpl @@ -1,3 +1,5 @@ +#chezmoi:template:left-delimiter=#{{ +#{{- /*- vim: filetype=bash */ -}} if [[ ${BASH_VERSION} != "3.2*" ]]; then shopt -s autocd fi @@ -14,27 +16,25 @@ if [[ ! $PROMPT_COMMAND =~ "history -a" ]]; then PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" fi -{{ if and (lookPath "setxkbmap") (eq .chezmoi.os "linux") -}} +#{{ if and (lookPath "setxkbmap") (eq .chezmoi.os "linux") -}} # Disable capslock setxkbmap -option ctrl:nocaps -{{- end }} +#{{- end }} -{{ if lookPath "lesspipe" -}} +#{{ if lookPath "lesspipe" -}} # make less more friendly for non-text input files, see lesspipe(1) -eval "$(SHELL=/bin/sh {{ lookPath "lesspipe" }})" -{{- end }} +eval "$(SHELL=/bin/sh #{{ lookPath "lesspipe" }})" +#{{- end }} -{{ if lookPath "dircolors" -}} +#{{ if lookPath "dircolors" -}} # enable color support of ls and also add handy aliases if test -r ~/.dircolors; then eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" fi -{{- end }} +#{{- end }} if [[ -d "${XDG_DATA_HOME}/JetBrains/Toolbox/scripts" ]]; then if [[ ":${PATH}:" != *":${XDG_DATA_HOME}/JetBrains/Toolbox/scripts:"* ]]; then export PATH="${PATH}:${XDG_DATA_HOME}/JetBrains/Toolbox/scripts" fi fi - -# vim: filetype=bash diff --git a/dot_config/bash/bashrc.d/completion.sh.tmpl b/dot_config/bash/bashrc.d/completion.sh.tmpl index 84bc249..4d4b4fd 100644 --- a/dot_config/bash/bashrc.d/completion.sh.tmpl +++ b/dot_config/bash/bashrc.d/completion.sh.tmpl @@ -1,14 +1,15 @@ -#!/usr/bin/env bash +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=bash */ -}} -{{ if stat "/etc/bash_completion" -}} +#{{ if stat "/etc/bash_completion" -}} source /etc/bash_completion -{{ end -}} +#{{ end -}} -{{ if stat "/usr/local/etc/bash_completion" -}} +#{{ if stat "/usr/local/etc/bash_completion" -}} source /usr/local/etc/bash_completion -{{ end -}} +#{{ end -}} -{{ if stat "/usr/local/etc/bash_completion.d/" -}} +#{{ if stat "/usr/local/etc/bash_completion.d/" -}} for i in $(ls /usr/local/etc/bash_completion.d/); do if [ -r "/usr/local/etc/bash_completion.d/$i" ]; then # shellcheck disable=SC1090 @@ -16,49 +17,46 @@ for i in $(ls /usr/local/etc/bash_completion.d/); do fi done unset i -{{ end -}} +#{{ end -}} -{{ if lookPath "brew" -}} +#{{ if lookPath "brew" -}} if [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then - . "$(brew --prefix)/share/bash-completion/bash_completion" + source "$(brew --prefix)/share/bash-completion/bash_completion" fi -{{ end -}} +#{{ end -}} -{{ if lookPath "direnv" -}} +#{{ if lookPath "direnv" -}} eval "$(direnv hook bash)" -{{ end -}} +#{{ end -}} -{{ if lookPath "erd" -}} +#{{ if lookPath "erd" -}} eval "$(erd --completions bash)" -{{ end -}} +#{{ end -}} -{{ if lookPath "helm" -}} +#{{ if lookPath "helm" -}} source <(helm completion bash) -{{ end -}} +#{{ end -}} -{{ if lookPath "kubectl" -}} +#{{ if lookPath "kubectl" -}} source <(kubectl completion bash) -{{ end -}} +#{{ end -}} -{{ if lookPath "starship" -}} +#{{ if lookPath "starship" -}} source <(starship init bash) -{{ end -}} +#{{ end -}} -{{ if lookPath "trubka" -}} +#{{ if lookPath "trubka" -}} eval "$(trubka --completion-script-bash)" -{{ end -}} +#{{ end -}} - -{{ if lookPath "rbenv" -}} +#{{ if lookPath "rbenv" -}} if [ "${RBENV_SHELL}" = "" ]; then eval "$(rbenv init -)" fi -{{ end -}} +#{{ end -}} -{{ if and (lookPath "rvm") (stat (joinPath .chezmoi.homeDir ".rvm" "bin") ) -}} +#{{ if and (lookPath "rvm") (stat (joinPath .chezmoi.homeDir ".rvm" "bin") ) -}} if [[ ! "${PATH}" =~ ${HOME}/.rvm/bin ]]; then export PATH="$PATH:$HOME/.rvm/bin" fi -{{ end -}} - -# vim: filetype=sh +#{{ end -}} diff --git a/dot_config/bash/env.d/base.env.tmpl b/dot_config/bash/env.d/base.env.tmpl new file mode 100644 index 0000000..0ab4b50 --- /dev/null +++ b/dot_config/bash/env.d/base.env.tmpl @@ -0,0 +1,9 @@ +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#shellcheck disable=SC2034 +HISTTIMEFORMAT='%y-%m-%d %T λ ' +QUOTING_STYLE=literal +#{{- if eq .chezmoi.os "darwin" }} +#shellcheck disable=SC2034 +BASH_SILENCE_DEPRECATION_WARNING=1 +#{{- end }} diff --git a/dot_config/bash/env.d/bash.env b/dot_config/bash/env.d/bash.env deleted file mode 100644 index 67032b1..0000000 --- a/dot_config/bash/env.d/bash.env +++ /dev/null @@ -1,3 +0,0 @@ -#shellcheck disable=SC2034 -HISTTIMEFORMAT='%y-%m-%d %T λ ' -QUOTING_STYLE=literal diff --git a/dot_config/bash/env.d/darwin.env.tmpl b/dot_config/bash/env.d/darwin.env.tmpl deleted file mode 100644 index 2e0279d..0000000 --- a/dot_config/bash/env.d/darwin.env.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -{{ if eq .chezmoi.os "darwin" -}} -#shellcheck disable=SC2034 -BASH_SILENCE_DEPRECATION_WARNING=1 -{{- end }} diff --git a/dot_config/bash/prompt.sh.tmpl b/dot_config/bash/prompt.sh.tmpl index 9d15a24..64fa44c 100644 --- a/dot_config/bash/prompt.sh.tmpl +++ b/dot_config/bash/prompt.sh.tmpl @@ -1,6 +1,8 @@ -{{ if not (lookPath "starship") -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=bash */ -}} +#{{ if not (lookPath "starship") -}} -{{ if lookPath "git" -}} +#{{ if lookPath "git" -}} _parse_git_status () ( if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then return @@ -14,7 +16,7 @@ _parse_git_status () ( _parse_git_branch () ( git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' ) -{{- end }} +#{{- end }} _create_prompt() ( color_off='\e[0m' @@ -26,10 +28,10 @@ _create_prompt() ( RET="\[$green\]"'\u '"\[$blue\]"'$(hostname -s | tr ':A-Z:' ':a-z:') '"\[$green\]\w " - {{ if lookPath "git" -}} + #{{ if lookPath "git" -}} RET="$RET\[$bblack\]"'$(_parse_git_branch)' RET="$RET\[$yellow\]"'$(_parse_git_status) ' - {{- end }} + #{{- end }} # display date RET="$RET\[$purple\]\D{%F %I:%M%P} " @@ -37,8 +39,5 @@ _create_prompt() ( echo "$RET" ) - PS1=$(_create_prompt) - -# vim: ft=bash -{{- end }} +#{{- end }} diff --git a/dot_config/fish/completions/completions.fish.tmpl b/dot_config/fish/completions/completions.fish.tmpl index c40be7b..d69a0aa 100644 --- a/dot_config/fish/completions/completions.fish.tmpl +++ b/dot_config/fish/completions/completions.fish.tmpl @@ -1,6 +1,8 @@ -{{ if lookPath "helm" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#{{ if lookPath "helm" -}} eval "$(helm completion fish)" -{{- end }} -{{ if lookPath "erd" -}} +#{{- end }} +#{{ if lookPath "erd" -}} eval "$(erd --completions fish)" -{{- end }} +#{{- end }} diff --git a/dot_config/git/config.tmpl b/dot_config/git/config.tmpl index a81154f..175c776 100644 --- a/dot_config/git/config.tmpl +++ b/dot_config/git/config.tmpl @@ -1,7 +1,10 @@ -{{ if lookPath "git" -}} +# chezmoi:template:left-delimiter=#{{ +# chezmoi:template:right-delimiter=}}# +#{{- /* vim: filetype=gitconfig */ -}}# +#{{ if lookPath "git" -}}# [core] editor = vim - excludesfile = {{ .chezmoi.homeDir }}/.config/git/ignore + excludesfile = #{{ .chezmoi.homeDir }}#/.config/git/ignore quotepath = false commitGraph = true @@ -72,16 +75,14 @@ [url "ssh://git@git.xbudex.com:2022"] insteadOf = https://git.xbudex.com -{{ if .hellotech -}} +#{{ if .hellotech -}}# [url "git@github.com:HelloTech"] insteadOf = https://github.com/HelloTech email = buddy@hellotech.com -{{ if lookPath "node" -}} +#{{ if lookPath "node" -}}# [init] - templateDir = {{ .chezmoi.homeDir }}/.config/git/template -{{- end }} -{{- end }} - -# vim: filetype=gitconfig -{{- end }} + templateDir = #{{ .chezmoi.homeDir }}#/.config/git/template +#{{- end }}# +#{{- end }}# +#{{- end }}# diff --git a/dot_config/git/ignore.tmpl b/dot_config/git/ignore.tmpl index 4ac9cb2..fd23fa8 100644 --- a/dot_config/git/ignore.tmpl +++ b/dot_config/git/ignore.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "git" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=conf */ -}} +#{{ if lookPath "git" -}} ################################################################################ ## This global gitignore file is assembled based the github gitignore project: ## https://github.com/github/gitignore @@ -33,4 +35,4 @@ Desktop.ini # Compass/sass ignores .sass-cache -{{- end }} +#{{- end }} diff --git a/dot_config/git/template/hooks/executable_prepare-commit-msg.tmpl b/dot_config/git/template/hooks/executable_prepare-commit-msg.tmpl index dee6fc7..0e1aeac 100644 --- a/dot_config/git/template/hooks/executable_prepare-commit-msg.tmpl +++ b/dot_config/git/template/hooks/executable_prepare-commit-msg.tmpl @@ -1,6 +1,8 @@ -{{ if and .hellotech (lookPath "node") -}} +// chezmoi:template:left-delimiter="/*{{" +// chezmoi:template:right-delimiter="}}*/" +/*{{- /* vim: filetype=javascript */ -}}*/ +/*{{ if and .hellotech (lookPath "node") -}}*/ #!/usr/bin/env node -// vim: ft=javascript const fs = require("fs"); const childProcess = require("child_process"); @@ -50,4 +52,4 @@ main().catch(err => { console.error(err); process.exit(1); }); -{{- end }} +/*{{- end }}*/ diff --git a/dot_config/i3/config.tmpl b/dot_config/i3/config.tmpl index fbb9f3e..de3fc36 100644 --- a/dot_config/i3/config.tmpl +++ b/dot_config/i3/config.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "i3" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=i3config */ -}} +#{{ if lookPath "i3" -}} # This file has been auto-generated by i3-config-wizard(1). # It will not be overwritten, so edit it as you like. # @@ -153,4 +155,4 @@ bindsym $mod+Control+l resize grow width 1 px or 1 ppt bar { status_command i3status } -{{- end }} +#{{- end }} diff --git a/dot_config/i3status/config.tmpl b/dot_config/i3status/config.tmpl index 20194ac..7378a1c 100644 --- a/dot_config/i3status/config.tmpl +++ b/dot_config/i3status/config.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "i3status" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=i3config */ -}} +#{{ if lookPath "i3status" -}} # i3status configuration file. # see "man i3status" for documentation. @@ -53,4 +55,4 @@ volume master { mixer = "Master" mixer_idx = 0 } -{{- end }} +#{{- end }} diff --git a/dot_config/lf/lfrc.tmpl b/dot_config/lf/lfrc.tmpl index a928c1c..24cba00 100644 --- a/dot_config/lf/lfrc.tmpl +++ b/dot_config/lf/lfrc.tmpl @@ -1,4 +1,7 @@ -{{ if lookPath "lf" -}} +# chezmoi:template:left-delimiter=#{{ +# chezmoi:template:right-delimiter=}}# +#{{- /* vim: filetype=conf */ -}}# +#{{ if lookPath "lf" -}}# set drawbox true set hidden true set icons true @@ -24,11 +27,11 @@ map , # find-prev (default ',') map o open -cmd open ${{ "{{" }} +cmd open ${{ case $(file --mime-type "$f" --brief --dereference) in text/*|application/json) $EDITOR "$f";; video/*|image/*|application/pdf) xdg-open "$f";; *) xdg-open "$f";; esac -{{ "}}" }} -{{- end }} +}} +#{{- end }}# diff --git a/dot_config/profile/env.d/base.env.tmpl b/dot_config/profile/env.d/base.env.tmpl index 785476d..e800c4e 100644 --- a/dot_config/profile/env.d/base.env.tmpl +++ b/dot_config/profile/env.d/base.env.tmpl @@ -1,3 +1,6 @@ +# chezmoi:template:left-delimiter=#{{ +# chezmoi:template:right-delimiter=}}# +#{{- /* vim: filetype=sh */ -}}# #shellcheck disable=SC2034 BROWSER=firefox HISTCONTROL=ignoredups:erasedups:ignorespace @@ -6,39 +9,37 @@ HISTSIZE= MAN_DIR=${XDG_DATA_HOME}/man/man1 PATH=${XDG_BIN_HOME}:${PATH} -{{- if lookPath "nvim" }} +#{{- if lookPath "nvim" }}# EDITOR=nvim -{{- else }} +#{{- else }}# EDITOR=vim -{{- end }} +#{{- end }}# -{{ if lookPath "bat" -}} +#{{ if lookPath "bat" -}}# BAT_PAGER=never BAT_STYLE=plain BAT_THEME=zenburn MANPAGER="sh -c 'col -bx | bat -l man -p'" -{{ end -}} +#{{ end -}}# -{{ if eq .chezmoi.os "darwin" -}} +#{{ if eq .chezmoi.os "darwin" -}}# CLICOLOR=1 -{{ end -}} +#{{ end -}}# -{{ if .hellotech -}} +#{{ if .hellotech -}}# GOPRIVATE=github.com/HelloTech PULUMI_SKIP_UPDATE_CHECK=true -{{ end -}} +#{{ end -}}# -{{ if and (lookPath "node") (stat (joinPath .chezmoi.homeDir ".config" "npm" "npmrc")) -}} +#{{ if and (lookPath "node") (stat (joinPath .chezmoi.homeDir ".config" "npm" "npmrc")) -}}# NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/npmrc" -{{ end -}} +#{{ end -}}# -{{ if lookPath "rg" -}} +#{{ if lookPath "rg" -}}# RIPGREP_CONFIG_PATH="${XDG_CONFIG_HOME}/ripgrep/config" -{{ end -}} +#{{ end -}}# -{{ if or (lookPath "vim") (lookPath "nvim") -}} +#{{ if or (lookPath "vim") (lookPath "nvim") -}}# VIMINIT='source $XDG_CONFIG_HOME/vim/vimrc' MYVIMRC='$XDG_CONFIG_HOME/vim/vimrc' -{{- end }} - -# vim: filetype=sh +#{{- end }}# diff --git a/dot_config/profile/profile.d/alias.sh.tmpl b/dot_config/profile/profile.d/alias.sh.tmpl index 23776f3..b9a4b4c 100644 --- a/dot_config/profile/profile.d/alias.sh.tmpl +++ b/dot_config/profile/profile.d/alias.sh.tmpl @@ -1,11 +1,13 @@ +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh -*/ -}} alias ll='ls -alF' alias curl='curl --proto-default https --silent ' alias to_lower="tr '[:upper:]' '[:lower:]'" alias to_upper="tr '[:lower:]' '[:upper:]'" -{{ if lookPath "nvim" -}} +#{{ if lookPath "nvim" -}} alias vim=nvim -{{- end }} +#{{- end }} alias node_lts="curl --silent https://nodejs.org/dist/index.tab | cut -f 1,10 | grep -v '-' | head -n 2 | tail -n 1 | cut -f 1" alias node_current="curl --silent https://nodejs.org/dist/index.tab | cut -f 1,10 | grep '-' | head -n 1 | cut -f 1" @@ -19,20 +21,18 @@ alias wget-opendir='wget --recursive --level 0 --continue --no-clobber \ alias numfiles='find . -maxdepth 1 -type f | wc -l' alias take='sudo chown $(whoami):$(whoami) ' -{{ if and (lookPath "jq") (lookPath "prettier") (lookPath "bat") -}} +#{{ if and (lookPath "jq") (lookPath "prettier") (lookPath "bat") -}} alias pretty_json='jq --compact-output | prettier --parser json | bat --language json' -{{- end }} +#{{- end }} -{{ if eq .chezmoi.os "linux" -}} +#{{ if eq .chezmoi.os "linux" -}} alias ls='ls --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' -{{- end }} +#{{- end }} -{{ if lookPath "bat" -}} +#{{ if lookPath "bat" -}} alias batdiff='batdiff --pager=""' alias cat=bat -{{- end }} - -# vim: filetype=sh +#{{- end }} diff --git a/dot_config/profile/profile.d/go.sh.tmpl b/dot_config/profile/profile.d/go.sh.tmpl index c8dad4a..9825012 100644 --- a/dot_config/profile/profile.d/go.sh.tmpl +++ b/dot_config/profile/profile.d/go.sh.tmpl @@ -1,11 +1,13 @@ -{{ if lookPath "go" -}} -{{ if stat "/usr/local/apps/golang/current/bin" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#{{- if lookPath "go" -}} +#{{ if stat "/usr/local/apps/golang/current/bin" -}} if [ -d /usr/local/apps/golang/current/bin ] && ! echo "${PATH}" | grep -q /usr/local/apps/golang/current/bin ; then PATH="/usr/local/apps/golang/current/bin:${PATH}" fi -{{- end }} +#{{- end }} if [ -d "${HOME}/go/bin" ] && ! echo "$PATH" | grep -q "${HOME}/go/bin" ; then PATH="${PATH}:${HOME}/go/bin" fi -{{- end }} +#{{- end }} diff --git a/dot_config/profile/profile.d/hellotech.sh.tmpl b/dot_config/profile/profile.d/hellotech.sh.tmpl index 9e52265..9aad50d 100644 --- a/dot_config/profile/profile.d/hellotech.sh.tmpl +++ b/dot_config/profile/profile.d/hellotech.sh.tmpl @@ -1,4 +1,6 @@ -{{ if .hellotech -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#{{- if .hellotech -}} k8s_last_config () ( dasel --read yaml --write json \ @@ -22,6 +24,4 @@ _add_path "/usr/local/opt/mysql-client/bin" _add_path "${HOME}/google-cloud-sdk/bin" unset _add_path - -# vim: filetype=sh -{{- end }} +#{{- end }} diff --git a/dot_config/profile/profile.d/ruby.sh.tmpl b/dot_config/profile/profile.d/ruby.sh.tmpl index 55e591b..30706ee 100644 --- a/dot_config/profile/profile.d/ruby.sh.tmpl +++ b/dot_config/profile/profile.d/ruby.sh.tmpl @@ -1,12 +1,14 @@ -{{ if lookPath "rbenv" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#{{- if lookPath "rbenv" -}} # shellcheck shell=sh if [ "${RBENV_SHELL}" = "" ]; then eval "$(rbenv init -)" fi -{{- end }} +#{{- end }} -{{ if lookPath "rvm" -}} +#{{ if lookPath "rvm" -}} if [ -d "${HOME}/.rvm/bin" ]; then case "${PATH}" in *"$HOME/.rvm/bin"*) ;; @@ -21,4 +23,4 @@ if [ "$(ps -p $$ -ocomm=)" = sh ]; then . "$HOME/.rvm/scripts/rvm" fi fi -{{- end }} +#{{- end }} diff --git a/dot_config/profile/profile.d/rust.sh.tmpl b/dot_config/profile/profile.d/rust.sh.tmpl index 5dda599..041f5d7 100644 --- a/dot_config/profile/profile.d/rust.sh.tmpl +++ b/dot_config/profile/profile.d/rust.sh.tmpl @@ -1,7 +1,7 @@ -{{ if lookPath "cargo" -}} -#!/usr/bin/env bash - +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=sh */ -}} +#{{- if lookPath "cargo" -}} if [ -f "${HOME}/.cargo/env" ]; then . "${HOME}/.cargo/env" fi -{{- end }} +#{{- end }} diff --git a/dot_config/starship.toml.tmpl b/dot_config/starship.toml.tmpl index 00d0c9b..3608bc7 100644 --- a/dot_config/starship.toml.tmpl +++ b/dot_config/starship.toml.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "starship" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=toml */ -}} +#{{- if lookPath "starship" -}} # Get editor completions based on the config schema "$schema" = 'https://starship.rs/config-schema.json' @@ -63,4 +65,4 @@ format = "[$duration]($style) " [character] success_symbol = "λ" error_symbol = "[☠](red)" -{{- end }} +#{{- end }} diff --git a/dot_config/systemd/user/podman.service.tmpl b/dot_config/systemd/user/podman.service.tmpl index 92b47c3..1539e7d 100644 --- a/dot_config/systemd/user/podman.service.tmpl +++ b/dot_config/systemd/user/podman.service.tmpl @@ -1,12 +1,15 @@ -{{ if lookPath "podman" -}} +# chezmoi:template:left-delimiter=#{{ +# chezmoi:template:right-delimiter=}}# +#{{- /* vim: filetype=systemd */ -}}# +#{{- if lookPath "podman" -}}# [Unit] Description=Podman service [Service] Type=simple -ExecStart={{ lookPath "podman" }} system service --time 0 +ExecStart=#{{ lookPath "podman" }}# system service --time 0 Restart=always [Install] WantedBy=default.target -{{- end }} +#{{- end }}# diff --git a/dot_config/tmux/plugins/executable_macos-color-workaround.tmpl b/dot_config/tmux/plugins/executable_macos-color-workaround.tmpl index bcc45ca..8909934 100644 --- a/dot_config/tmux/plugins/executable_macos-color-workaround.tmpl +++ b/dot_config/tmux/plugins/executable_macos-color-workaround.tmpl @@ -1,4 +1,6 @@ -{{ if and (lookPath "tmux") (eq .chezmoi.os "darwin") -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=bash */ -}} +#{{- if and (lookPath "tmux") (eq .chezmoi.os "darwin") -}} #!/usr/bin/env bash if [ "$(uname -s)" == "Darwin" ]; then @@ -7,4 +9,4 @@ fi tmux set default-terminal "tmux-256color" tmux set terminal-overrides ",xterm-256color:Tc" -{{- end }} +#{{- end }} diff --git a/dot_config/tmux/tmux.conf.tmpl b/dot_config/tmux/tmux.conf.tmpl index cf299e1..417183b 100644 --- a/dot_config/tmux/tmux.conf.tmpl +++ b/dot_config/tmux/tmux.conf.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "tmux" -}} +# chezmoi:template:left-delimiter="# {{" +# {{- /* vim: filetype=tmux */ -}} +# {{- if lookPath "tmux" -}} ################################################################################ # Base configuration ################################################################################ @@ -33,9 +35,9 @@ set-option -g mouse on ################################################################################ # Colors ################################################################################ -{{ if eq .chezmoi.os "darwin" -}} +# {{ if eq .chezmoi.os "darwin" -}} run $XDG_CONFIG_HOME/tmux/plugins/macos-color-workaround -{{ end }} +# {{ end }} set -g status-fg white set -g status-bg black @@ -88,4 +90,4 @@ set -g @prefix_highlight_show_sync_mode 'on' set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow' run $XDG_CONFIG_HOME/tmux/plugins/tpm/tpm -{{- end }} +# {{- end }} diff --git a/dot_config/user-dirs.dirs.tmpl b/dot_config/user-dirs.dirs.tmpl index 79d2ebd..9bb46d6 100644 --- a/dot_config/user-dirs.dirs.tmpl +++ b/dot_config/user-dirs.dirs.tmpl @@ -1,11 +1,13 @@ -{{- if or (eq .chezmoi.os "linux") (eq .chezmoi.os "darwin") -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: ft=sh */ -}} +#{{- if or (eq .chezmoi.os "linux") (eq .chezmoi.os "darwin") -}} # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run. # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. -{{ if eq .chezmoi.os "linux" -}} +#{{ if eq .chezmoi.os "linux" -}} XDG_DESKTOP_DIR=$HOME/desktop XDG_DOCUMENTS_DIR=$HOME/documents XDG_DOWNLOAD_DIR=$HOME/downloads @@ -15,7 +17,7 @@ XDG_PODCAST_DIR=$HOME/podcasts XDG_PUBLICSHARE_DIR=$HOME/public XDG_TEMPLATES_DIR=$HOME/templates XDG_VIDEOS_DIR=$HOME/videos -{{- else if eq .chezmoi.os "darwin" -}} +#{{- else if eq .chezmoi.os "darwin" -}} XDG_DESKTOP_DIR=$HOME/Desktop XDG_DOCUMENTS_DIR=$HOME/Documents XDG_DOWNLOAD_DIR=$HOME/Downloads @@ -25,5 +27,5 @@ XDG_PODCAST_DIR=$HOME/Podcasts XDG_PUBLICSHARE_DIR=$HOME/Public XDG_TEMPLATES_DIR=$HOME/Templates XDG_VIDEOS_DIR=$HOME/Movies -{{- end -}} -{{- end }} +#{{- end }} +#{{- end }} diff --git a/dot_config/vim/ftplugin/go.vim.tmpl b/dot_config/vim/ftplugin/go.vim.tmpl index d9f04d5..8c7ddd9 100644 --- a/dot_config/vim/ftplugin/go.vim.tmpl +++ b/dot_config/vim/ftplugin/go.vim.tmpl @@ -1,10 +1,12 @@ -{{ if lookPath "go" -}} +# chezmoi:template:left-delimiter="{{ +"{{- /* vim: filetype=vim */ -}} +"{{- if lookPath "go" -}} set noexpandtab -{{ if lookPath "goimports" -}} +"{{ if lookPath "goimports" -}} " use goimports for formatting let g:go_fmt_command = "goimports" -{{- end }} +"{{- end }} " turn highlighting on let g:go_highlight_functions = 1 @@ -16,6 +18,4 @@ let g:go_highlight_build_constraints = 1 " Open go doc in vertical window, horizontal, or tab nnoremap d :GoDef nnoremap t :GoDefType - -" vim: filetype=vim -{{- end }} +"{{- end }} diff --git a/dot_config/vim/ftplugin/rust.vim.tmpl b/dot_config/vim/ftplugin/rust.vim.tmpl index 4621727..57eed93 100644 --- a/dot_config/vim/ftplugin/rust.vim.tmpl +++ b/dot_config/vim/ftplugin/rust.vim.tmpl @@ -1,3 +1,5 @@ -{{ if lookPath "rustc" -}} +" chezmoi:template:left-delimiter="{{ +"{{- /* vim: filetype=vim */ -}} +"{{- if lookPath "rustc" -}} let g:rustfmt_autosave = 1 -{{- end }} +"{{- end }} diff --git a/dot_config/vim/plug.d/fzf.vim.tmpl b/dot_config/vim/plug.d/fzf.vim.tmpl index 1a9aa52..86a9b6e 100644 --- a/dot_config/vim/plug.d/fzf.vim.tmpl +++ b/dot_config/vim/plug.d/fzf.vim.tmpl @@ -1,7 +1,9 @@ -{{ if lookPath "fzf" -}} +" chezmoi:template:left-delimiter="{{ +"{{- /* vim: filetype=vim */ -}} +"{{- if lookPath "fzf" -}} Plug 'junegunn/fzf', { 'tag': '0.40.0' } Plug 'junegunn/fzf.vim' map fz :GFiles map rg :Rg -{{- end }} +"{{- end }} diff --git a/dot_config/vim/plug.d/go.vim.tmpl b/dot_config/vim/plug.d/go.vim.tmpl index 0a94c6d..500b7f6 100644 --- a/dot_config/vim/plug.d/go.vim.tmpl +++ b/dot_config/vim/plug.d/go.vim.tmpl @@ -1,3 +1,5 @@ -{{ if lookPath "go" -}} +" chezmoi:template:left-delimiter="{{ +"{{- /* vim: filetype=vim */ -}} +"{{- if lookPath "go" -}} Plug 'fatih/vim-go' -{{- end }} +"{{- end }} diff --git a/dot_config/vim/plug.d/rust.vim.tmpl b/dot_config/vim/plug.d/rust.vim.tmpl index 1a53f08..7090333 100644 --- a/dot_config/vim/plug.d/rust.vim.tmpl +++ b/dot_config/vim/plug.d/rust.vim.tmpl @@ -1,3 +1,5 @@ -{{ if lookPath "rustc" -}} +" chezmoi:template:left-delimiter="{{ +"{{- /* vim: filetype=vim */ -}} +"{{- if lookPath "rustc" -}} Plug 'rust-lang/rust.vim', { 'for': 'rust' } -{{- end }} +"{{- end }} diff --git a/dot_config/vim/snips/go.snippets.tmpl b/dot_config/vim/snips/go.snippets.tmpl index 655be46..516317e 100644 --- a/dot_config/vim/snips/go.snippets.tmpl +++ b/dot_config/vim/snips/go.snippets.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "go" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=snippets */ -}} +#{{- if lookPath "go" -}} snippet ignore "ignore function" ! func(...any) {}(${1}) endsnippet @@ -44,4 +46,4 @@ func Test${1}(t *testing.T) { } } endsnippet -{{- end }} +#{{- end }} diff --git a/dot_config/zsh/zshrc.d/base.zsh.tmpl b/dot_config/zsh/zshrc.d/base.zsh.tmpl index 7e3d603..ddff6b7 100644 --- a/dot_config/zsh/zshrc.d/base.zsh.tmpl +++ b/dot_config/zsh/zshrc.d/base.zsh.tmpl @@ -1,3 +1,5 @@ +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=zsh */ -}} setopt autocd setopt autopushd setopt pushdignoredups @@ -30,59 +32,57 @@ zstyle ':completion:*' verbose true zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' -{{ if and (lookPath "dircolors") (eq .chezmoi.os "linux") -}} +#{{ if and (lookPath "dircolors") (eq .chezmoi.os "linux") -}} eval "$(dircolors -b)" -{{ end -}} +#{{ end -}} -{{- if lookPath "bat" -}} +#{{- if lookPath "bat" -}} alias cat=bat -{{ end -}} +#{{ end -}} -{{- if lookPath "direnv" -}} +#{{- if lookPath "direnv" -}} eval "$(direnv hook zsh)" -{{ end -}} +#{{ end -}} -{{- if lookPath "erd" -}} +#{{- if lookPath "erd" -}} autoload -Uz compinit compinit eval "$(erd --completions zsh)" -{{ end -}} +#{{ end -}} -{{- if lookPath "helm" -}} +#{{- if lookPath "helm" -}} # shellcheck disable=SC2148,SC1090 autoload -U +X compinit && compinit source <(helm completion zsh) -{{ end -}} +#{{ end -}} -{{- if lookPath "kubectl" -}} +#{{- if lookPath "kubectl" -}} # shellcheck disable=SC2148,SC1090 autoload -U +X compinit && compinit source <(kubectl completion zsh) -{{ end -}} +#{{ end -}} -{{- if lookPath "rbenv" -}} +#{{- if lookPath "rbenv" -}} if [ "${RBENV_SHELL}" = "" ]; then eval "$(rbenv init -)" fi -{{ end -}} +#{{ end -}} -{{- if lookPath "rvm" }} +#{{- if lookPath "rvm" }} if [[ -d "${HOME}/.rvm/bin" ]]; then if [[ ! "${PATH}" =~ "${HOME}/.rvm/bin" ]]; then export PATH="$PATH:$HOME/.rvm/bin" fi fi -{{ end -}} +#{{ end -}} -{{- if lookPath "starship" -}} +#{{- if lookPath "starship" -}} source <(starship init zsh) -{{ end -}} +#{{ end -}} -{{- if lookPath "tmux" }} +#{{- if lookPath "tmux" }} if [ "$TMUX" ]; then # TERM=tmux-256color does not work as expected on osx export TERM=screen-256color fi -{{- end }} - -# vim: filetype=zsh +#{{- end }} diff --git a/dot_jq/colors.jq.tmpl b/dot_jq/colors.jq.tmpl index 707681e..c162bb7 100644 --- a/dot_jq/colors.jq.tmpl +++ b/dot_jq/colors.jq.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "jq" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=jq */ -}} +#{{- if lookPath "jq" -}} def reset: "\u001b[0m"; def black: "\u001b[30m"; def white: "\u001b[97m"; @@ -8,4 +10,4 @@ def green: "\u001b[32m"; def yellow: "\u001b[33m"; def red: "\u001b[31m"; def magenta: "\u001b[35m"; -{{- end }} +#{{- end }} diff --git a/dot_jq/env.jq.tmpl b/dot_jq/env.jq.tmpl index 8321398..4737303 100644 --- a/dot_jq/env.jq.tmpl +++ b/dot_jq/env.jq.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "jq" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=jq */ -}} +#{{- if lookPath "jq" -}} def browser: env.BROWSER; def editor: env.EDITOR; def home: env.HOME; @@ -13,4 +15,4 @@ def config: env.XDG_CONFIG_HOME; def data: env.XDG_DATA_HOME; def runtime: env.XDG_RUNTIME_DIR; def state: env.XDG_STATE_HOME; -{{- end }} +#{{- end }} diff --git a/dot_jq/github.jq.tmpl b/dot_jq/github.jq.tmpl index 040989d..9ed8694 100644 --- a/dot_jq/github.jq.tmpl +++ b/dot_jq/github.jq.tmpl @@ -1,4 +1,6 @@ -{{ if lookPath "jq" -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=jq */ -}} +#{{- if lookPath "jq" -}} def by_time: sort_by(.created_at) | reverse; def asset($os; $arch): @@ -26,4 +28,4 @@ assets ] | join("\n") ) "; -{{- end }} +#{{- end }} diff --git a/dot_jq/ht.jq.tmpl b/dot_jq/ht.jq.tmpl index 6fde48b..b697a61 100644 --- a/dot_jq/ht.jq.tmpl +++ b/dot_jq/ht.jq.tmpl @@ -1,4 +1,6 @@ -{{ if and .hellotech (lookPath "jq") -}} +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: filetype=jq */ -}} +#{{- if and .hellotech (lookPath "jq") -}} import "colors" as colors; def clean_multierror: @@ -76,4 +78,4 @@ def show: "\n" + colors::red + "ERROR" + colors::reset + ": " + _show_error else "" end ) + colors::reset; -{{- end }} +#{{- end }}