Fixes to precommit hook and reformat some zsh files
This commit is contained in:
parent
3614b66354
commit
e85469a11b
|
@ -17,7 +17,7 @@ if [ "$num_staged_toml" -gt 0 ]; then
|
||||||
printf '\nFormatting %s staged TOML files with taplo\n' "$num_staged_toml"
|
printf '\nFormatting %s staged TOML files with taplo\n' "$num_staged_toml"
|
||||||
taplo format "$staged_toml"
|
taplo format "$staged_toml"
|
||||||
printf "Re-staging\n"
|
printf "Re-staging\n"
|
||||||
git add "$staged_toml"
|
git add $staged_toml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run lua-format on staged Lua files
|
# Run lua-format on staged Lua files
|
||||||
|
@ -39,9 +39,9 @@ staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true)
|
||||||
num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
|
num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
|
||||||
if [ "$num_staged_sh" -gt 0 ]; then
|
if [ "$num_staged_sh" -gt 0 ]; then
|
||||||
printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
|
printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
|
||||||
shfmt -w "$staged_sh"
|
shfmt -w $staged_sh
|
||||||
printf "Re-staging\n\n"
|
printf "Re-staging\n\n"
|
||||||
git add "$staged_sh"
|
git add $staged_sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run prettier on all other staged files
|
# Run prettier on all other staged files
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Launch tmux if logging in over ssh
|
# Launch tmux if logging in over ssh
|
||||||
if [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
|
if [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
|
||||||
if tmux has-session -t ssh_tmux 2>/dev/null; then
|
if tmux has-session -t ssh_tmux 2>/dev/null; then
|
||||||
exec tmux -2 attach-session -t ssh_tmux
|
exec tmux -2 attach-session -t ssh_tmux
|
||||||
else
|
else
|
||||||
exec tmux -2 new-session -s ssh_tmux
|
exec tmux -2 new-session -s ssh_tmux
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -46,12 +46,12 @@ export FZF_COMPLETION_TRIGGER='**'
|
||||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --strip-cwd-prefix"
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --strip-cwd-prefix"
|
||||||
export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"'
|
export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"'
|
||||||
_fzf_compgen_path() {
|
_fzf_compgen_path() {
|
||||||
resultcmd="$FZF_DEFAULT_COMMAND . $1"
|
resultcmd="$FZF_DEFAULT_COMMAND . $1"
|
||||||
eval ${resultcmd}
|
eval ${resultcmd}
|
||||||
}
|
}
|
||||||
_fzf_compgen_dir() {
|
_fzf_compgen_dir() {
|
||||||
resultcmd="$FZF_ALT_C_COMMAND . $1"
|
resultcmd="$FZF_ALT_C_COMMAND . $1"
|
||||||
eval ${resultcmd}
|
eval ${resultcmd}
|
||||||
}
|
}
|
||||||
|
|
||||||
# dotfile repository location
|
# dotfile repository location
|
||||||
|
@ -72,7 +72,7 @@ export NEOVIDE_MULTIGRID=1
|
||||||
|
|
||||||
{%@@ if distro_id == "arch" or distro_id == "ubuntu" @@%}
|
{%@@ if distro_id == "arch" or distro_id == "ubuntu" @@%}
|
||||||
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||||
fi
|
fi
|
||||||
gpgconf --launch gpg-agent
|
gpgconf --launch gpg-agent
|
||||||
{%@@ elif distro_id == "termux" @@%}
|
{%@@ elif distro_id == "termux" @@%}
|
||||||
|
|
|
@ -5,13 +5,13 @@ zshcache_time="$(date +%s%N)"
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
rehash_precmd() {
|
rehash_precmd() {
|
||||||
if [[ -e /var/cache/zsh/pacman ]]; then
|
if [[ -e /var/cache/zsh/pacman ]]; then
|
||||||
local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
|
local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
|
||||||
if ((zshcache_time < paccache_time)); then
|
if ((zshcache_time < paccache_time)); then
|
||||||
rehash
|
rehash
|
||||||
zshcache_time="$paccache_time"
|
zshcache_time="$paccache_time"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add-zsh-hook -Uz precmd rehash_precmd
|
add-zsh-hook -Uz precmd rehash_precmd
|
||||||
|
|
Loading…
Reference in a new issue