This commit is contained in:
parent
c449dfcb5f
commit
559939e2f4
49 changed files with 729 additions and 252 deletions
|
|
@ -1,8 +1,5 @@
|
|||
. ~/.config/zsh/modes.sh
|
||||
|
||||
fpath=($HOME/.local/share/completions $fpath)
|
||||
|
||||
# ls colors
|
||||
eval "$(zoxide init zsh --cmd j)"
|
||||
eval "$(dircolors -b)"
|
||||
|
||||
# history
|
||||
|
|
@ -10,7 +7,6 @@ HISTSIZE=10000000
|
|||
SAVEHIST=10000000
|
||||
HISTFILE="${HOME}/.cache/zsh_history"
|
||||
alias history='history 1000000000000000'
|
||||
alias hist='history'
|
||||
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups
|
||||
|
|
@ -90,10 +86,9 @@ alias venv='source src_venv'
|
|||
alias ex='source src_example'
|
||||
alias pa='source src_add_path'
|
||||
alias info='pinfo'
|
||||
alias bat='bat '
|
||||
alias bat='bat'
|
||||
alias img='nsxiv'
|
||||
alias xclip='xclip -selection clipboard'
|
||||
alias xcp='perl -pe "chomp if eof" | xclip -selection clipboard'
|
||||
alias rgf='rg --files | rg'
|
||||
alias wt='watch --color -d -cn 0.1 '
|
||||
alias .e='set -a && source .env && set +a'
|
||||
|
|
@ -107,78 +102,98 @@ alias open='xdg-open'
|
|||
alias m.='if mount | grep -q "$(pwd)"; then umount -l .; cd .; else mount .; cd .; fi'
|
||||
alias rs='stow -R .'
|
||||
alias sst='ssh -t'
|
||||
alias rdj='rmdir ./*'
|
||||
alias rdj='rmdir --ignore-fail-on-non-empty ./* 2>/dev/null'
|
||||
alias rdr='rmdir --ignore-fail-on-non-empty ./**/* 2>/dev/null'
|
||||
alias qr='qrencode -t ansiutf8'
|
||||
alias rgi='rg --no-ignore --hidden'
|
||||
alias rgi='rg -i'
|
||||
alias rgn='rg --no-ignore --hidden'
|
||||
alias rgni='rg --no-ignore --hidden -i'
|
||||
alias cal='cal -3'
|
||||
alias s='s '
|
||||
alias t='vi ~/todo.md'
|
||||
alias c.='cloc --vcs=git .'
|
||||
alias yt='noglob yt-dlp'
|
||||
alias b64='base64'
|
||||
|
||||
# function aliases
|
||||
mkexe() { touch "${1?}"; chmod +x "$1"; }; compdef _files mkexe;
|
||||
bl() { brightnessctl set "$1"% > /dev/null; }
|
||||
nosw() { alacritty --class 'noswallow' -e "$@"; }; compdef _command nosw
|
||||
vims() { filepath="$(type "$1" | rev | cut -d ' ' -f 1 | rev)"; [ $? -eq 0 ] && vim "${filepath}"; }; compdef _command vims
|
||||
tl() { tree -C "$@" | bat }; compdef _tree tl
|
||||
tl() { tree -C "$@" | bat; }; compdef _tree tl
|
||||
diff() { /usr/bin/diff --color -u "$@" | delta; }; compdef _files di;
|
||||
xcp() { perl -pe "chomp if eof" | xclip -selection clipboard; }
|
||||
|
||||
# compdef
|
||||
compdef -a '_git; _git-commit' gdc # todo
|
||||
compdef '_files -g "*.md"' md
|
||||
compdef _command s
|
||||
|
||||
# ansible
|
||||
alias ap='ansible-playbook'
|
||||
alias ag='ansible-galaxy'
|
||||
|
||||
# git aliases
|
||||
compdef -a '_git; _git-commit' gdc # todo
|
||||
compdef -a '_git; _git-ls-files' gls # todo
|
||||
# compdef -a '_git; _git-reset' grt # todo
|
||||
alias grt='git reset'
|
||||
|
||||
gl() { git log --decorate "$@" | bat }; compdef '_git; _git-log' gl
|
||||
gus() { git branch --set-upstream-to="${1:?}/${2:?}" "${2:?}" }; compdef '_git; _git-push' gus
|
||||
gpo() { git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" "$@" }
|
||||
gru() { git remote get-url "${1-origin}" }; compdef '_gor' gru
|
||||
gtr() { gls $1 | tree --fromfile . }
|
||||
alias ga="git add"
|
||||
alias ga.="git add ." # always fatfinger this
|
||||
alias gb="git branch"
|
||||
alias gc="git commit"
|
||||
alias gca="git commit --allow-empty-message --amend --no-edit"
|
||||
alias gca="git commit --allow-empty-message --amend --no-edit --date now"
|
||||
alias gcad='gca --no-gpg-sign'
|
||||
alias gcan="git commit --allow-empty-message --amend --no-edit --no-date"
|
||||
alias gcd='git commit --no-gpg-sign'
|
||||
alias gck="git checkout"
|
||||
alias gcl="git clone"
|
||||
alias gcln!='git clean -xfd'
|
||||
alias gcln='git clean -nxfd'
|
||||
alias gcls="git clone --depth=1"
|
||||
alias gcm="git commit --allow-empty-message -m ''"
|
||||
alias gcd='git commit --no-gpg-sign'
|
||||
alias gcmd="git commit --allow-empty-message -m '' --no-gpg-sign"
|
||||
alias gcn="git clean -nfd"
|
||||
alias gcn!="git clean -fd"
|
||||
alias gcn="git clean -nfd"
|
||||
alias gcp="git cherry-pick"
|
||||
alias gct="gc -am 'Add files via upload :trollface:'"
|
||||
alias gd="git diff"
|
||||
alias gdj='DELTA_FEATURES="+side-by-side" gd'
|
||||
alias gds="gd --staged"
|
||||
alias 'gd?'="gd --stat"
|
||||
alias 'gds?'="gds --stat"
|
||||
alias gdsj='DELTA_FEATURES="+side-by-side" gds'
|
||||
alias gdv='git difftool --tool=vimdiff'
|
||||
alias gf="git fetch"
|
||||
alias gi="git init"
|
||||
alias gla="gl --all"
|
||||
alias glp='gl --pretty=fuller'
|
||||
alias gm="git merge"
|
||||
alias gp="git push"
|
||||
alias gpu="git pull"
|
||||
alias gr="git restore"
|
||||
alias grc='git rm --cached'
|
||||
alias grj="git rebase"
|
||||
alias grjc="git rebase --continue"
|
||||
alias grjs="git rebase --cancel"
|
||||
alias grm="git remote"
|
||||
alias grs="git restore --staged"
|
||||
alias grt="git reset"
|
||||
alias grt!="git reset --hard"
|
||||
alias gsm='git submodule'
|
||||
alias grc='git rm --cached'
|
||||
alias grt!="grt --hard"
|
||||
alias gs="git status"
|
||||
alias gs.='git status .'
|
||||
alias gsc="git switch -C"
|
||||
alias gsh="git show"
|
||||
alias 'gsh?'="git show --stat"
|
||||
alias gshj='DELTA_FEATURES="+side-by-side" gsh'
|
||||
alias gsj="git stash"
|
||||
alias gsl="git stash list"
|
||||
alias gsm='git submodule'
|
||||
alias gsp="git stash pop"
|
||||
alias gt="git tag"
|
||||
alias gus="git fetch --unshallow"
|
||||
alias gdj='DELTA_FEATURES="+side-by-side" gd'
|
||||
alias gdsj='DELTA_FEATURES="+side-by-side" gds'
|
||||
alias gshj='DELTA_FEATURES="+side-by-side" gsh'
|
||||
alias gcln='git clean -nxfd'
|
||||
alias gcln!='git clean -xfd'
|
||||
alias gct="gc -am 'Add files via upload :trollface:'"
|
||||
|
||||
# docker aliases
|
||||
alias d='docker'
|
||||
|
|
@ -188,6 +203,7 @@ alias dc!='d! compose'
|
|||
|
||||
alias di='d image'
|
||||
alias dj='dc up -d --force-recreate'
|
||||
alias djn='dc up -d'
|
||||
alias djb='dj --build'
|
||||
alias djbl='djb && dl'
|
||||
alias djl='dj && dl'
|
||||
|
|
@ -197,16 +213,38 @@ alias dr='d run --rm -it'
|
|||
alias drs='dc restart'
|
||||
alias drsl='dc restart && dl'
|
||||
alias dv='d volume'
|
||||
alias ds='dc stop'
|
||||
|
||||
# tmux stuff
|
||||
tn() { tmux new-session -s "${1-"$(basename "$(pwd)")"}" }
|
||||
alias ta='tmux a -t'
|
||||
# ta() { tmux a -t "$1" }; compdef '_tmux; _tmux-attach-session' ta
|
||||
ta() { tmux a -t "$1" }
|
||||
# alias ta='tmux a -t'
|
||||
|
||||
# disable xon control chars
|
||||
stty -ixon
|
||||
|
||||
# print tasks on startup
|
||||
_ZSH_TODO_FILE="${HOME}/todo.md"
|
||||
[ -f "$_ZSH_TODO_FILE" ] && { cat "$_ZSH_TODO_FILE" | grep -v '>.*'; }
|
||||
unset _ZSH_TODO_FILE
|
||||
TODO_FILE="${HOME}/todo.md"
|
||||
[ -f "$TODO_FILE" ] && { cat "$TODO_FILE" | grep -v '>.*'; }
|
||||
unset TODO_FILE
|
||||
|
||||
setopt extendedglob
|
||||
autoload add-zsh-hook
|
||||
for file in "$ZDOTDIR/cd_hooks/"^_*; do
|
||||
fname="cd_::$(basename "$file")"
|
||||
eval "
|
||||
$fname() {
|
||||
$(cat "$file")"'
|
||||
if [ -n "$DIRNAME" ]; then
|
||||
if [[ "$PWD/" = "$DIRNAME"*/ && ( "$OLDPWD/" != "$DIRNAME"*/ || "$PWD" = "$OLDPWD" ) ]]; then cd::enter
|
||||
elif [[ "$PWD/" != "$DIRNAME"*/ && "$OLDPWD/" = "$DIRNAME"*/ ]]; then cd::leave; fi
|
||||
elif [ -n "$BASE_DIR" ]; then
|
||||
: # TODO: handle
|
||||
fi
|
||||
}
|
||||
'
|
||||
add-zsh-hook chpwd "$fname"
|
||||
"$fname"
|
||||
done
|
||||
unsetopt extendedglob
|
||||
CD_HOOKS_COMPLETED=1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue