Added dotfile commands and completealiases

This commit is contained in:
Alexander Rosenberg 2023-05-03 23:02:59 -07:00
parent 0402a8b20b
commit 0f927aa2a0
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -25,7 +25,7 @@ function source_user_file {
source_user_file "early-init.zsh"
# Some options
setopt autocd extendedglob rm_star_silent
setopt autocd extendedglob rm_star_silent completealiases
unsetopt beep notify
# Some general, random configuration
@ -121,6 +121,23 @@ alias gu="git pull"
alias gf="git fetch"
alias gt="git status"
# Dotfile management
function dots {
local args=("--git-dir=${HOME}/src/dotfiles" '--work-tree=/' '--bare')
if (( ${#} == 0 )); then
(cd /
for file in $(git ${args} ls-files); do
printf '%s\t%s\t\e[38;2;255;255;0m%s\e[m\n' \
"$(git ${args} -c color.status=always status -s "${file}" | sed "s#${file}##")" \
"/${file}" \
"$(git ${args} log --max-count=1 --format='%s' "${file}")"
done) | column -t -T2 --separator=" "
else
git ${args} "${@}"
fi
}
compdef -e "words[1]=(git '--git-dir=${HOME}/src/dotfiles' --work-tree=/ --bare); service=git; (( CURRENT+=3 )); _git" dots
# Sudo last line with <Esc><Esc>
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history