diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
| commit | 5ff02959d3069923bca63cb54c4bb246b86bf20d (patch) | |
| tree | 7ef1b56fb85a48c563bb3af51c26f181741282be /fedora/.config/shell | |
| parent | f65fe7591c18d6c8f4ecac5f379407a910aba1bc (diff) | |
deleted .gnupg/gpg-agent.conf, created .gnupg/, created .config/, created .local/, created .gnupg/
Diffstat (limited to 'fedora/.config/shell')
| -rw-r--r-- | fedora/.config/shell/aliasrc | 386 | ||||
| -rw-r--r-- | fedora/.config/shell/bm-dirs | 37 | ||||
| -rw-r--r-- | fedora/.config/shell/bm-files | 19 | ||||
| -rw-r--r-- | fedora/.config/shell/git-aliasrc | 415 | ||||
| -rw-r--r-- | fedora/.config/shell/inputrc | 31 | ||||
| -rw-r--r-- | fedora/.config/shell/profile | 151 | ||||
| -rw-r--r-- | fedora/.config/shell/scripts.bash | 54 |
7 files changed, 1093 insertions, 0 deletions
diff --git a/fedora/.config/shell/aliasrc b/fedora/.config/shell/aliasrc new file mode 100644 index 0000000..6b35701 --- /dev/null +++ b/fedora/.config/shell/aliasrc @@ -0,0 +1,386 @@ +# alias - normal aliases (completed with trailing space) +# balias - blank aliases (completed without space) +# ialias - ignored aliases (not completed) + +# sudo not required for some system commands +for command in blkid lsblk mount umount dnf poweroff reboot shutdown su updatedb; do + alias $command="sudo $command" +done +unset command + +case "$(readlink -f /sbin/init)" in +*systemd*) + # journal + alias -g jctl='journalctl -xe' + alias -g jctlou='sudo journalctl -b -n 200 -f' + alias -g rpi='systemctl --user restart wireplumber pipewire pipewire-pulse pipewire-jack' + alias -g sctl='systemctl' + alias -g sctlss='systemctl status' + alias -g sctle='systemctl enable' + alias -g sctld='systemctl disable' + alias -g sctlr='systemctl restart' + alias -g sctls='systemctl start' + alias -g sctlt='systemctl stop' + alias -g sctldr='systemctl daemon-reload' + alias -g tctl='timedatectl' + ;; +esac + +# Go back +alias ...='../..' +alias ....='../../..' +alias .....='../../../..' + +# bash +alias sbp="source ~/.config/bash/bash_profile" +alias sbs="source ~/.config/bash/bashrc" + +# cd +alias cf='cd "$(dirname "$(readlink -f health.lua)")"' +alias pd='cd -' + +# chmod +alias che='find . -type f -exec chmod +x {};' +alias chfd='find . -type d -exec chmod 755 {}; -o -type f -exec chmod 644 {};' +alias cx='chmod a+x' +alias 000='chmod -R 000' +alias 600='chmod -R 600' +alias 644='chmod -R 644' +alias 666='chmod -R 666' +alias 755='chmod -R 755' +alias 777='chmod -R 777' + +# copy +alias CC='$(fc -l -n -1) | xclip -selection clipboard' +ialias cp='cp -iv' +alias pwdc='pwd | xclip -selection clipboard' + +# count +alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null" + +# curl +ialias curl='curl --silent --show-error' +balias clh='curl localhost:' +balias clh8='curl localhost:8080' +balias clh9='curl localhost:9080' +balias c100='curl 192.168.99.100:' + +# date +alias da="date '+%Y-%m-%d %A %T %Z'" + +# delete +alias _fd='find . -type f -name "._*" -print0 | xargs -0 rm -f' +alias _fp='find . -type f -name "._*" -print' + +# diff +ialias diff='diff --color' + +# disk +alias diskspace="du -S | sort -n -r |more" +alias folders="du -h --max-depth=1" +alias folderssort="find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn" +alias tree="tree -CAhF --dirsfirst" +alias treed="tree -CAFd" +alias mountedinfo="df -hT" + +# docker +alias dk='docker' +alias dkp='docker ps' +alias dkpa='docker ps -a' +alias dkpaq='docker ps -a -q' +alias dkb='docker build -t' +alias dkbnc='docker build --no-cache -t' +alias dkr='docker run --rm' +alias dkrti='docker run --rm -ti' +alias dkrd='docker run -d' +alias dkrp8='docker run --rm -p 8080:8080' +alias dkrp9='docker run --rm -p 9080:9080' +alias dks='docker start' +alias dkt='docker stop' +alias dktt='docker stop $(docker ps -q)' +alias dkk='docker kill' +alias dkkk='docker kill $(docker ps -q)' +alias dkrm='docker rm' +alias dkri='docker rmi' +alias dke='docker exec -ti' +alias dkl='docker logs -f' +alias dki='docker images' +alias dkpu='docker pull' +alias dkph='docker push' +alias dkin='docker inspect' +alias dkn='docker network' +alias dkc='docker-compose' +alias dkcu='docker-compose up' +alias dkclean='docker ps -q -a -f status=exited | xargs -r docker rm && docker images -q -f dangling=true | xargs -r docker rmi' + +# find +balias fdn='find . -name "' +alias f="find . | grep " + +# grep +ialias -g grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}' +alias grepi='grep -i' +alias grepr='grep -r' +alias grepri='grep -ri' +alias grepw='grep -R -i --include="*"' +alias grepb='grep -R -i --include="*" --exclude-dir="zsh"' +alias -g Gg='| grep' +alias -g Gi='| grep -i' +alias -g GH='| grep HTTP' + +# hash +alias h='hash -rf' + +# hexdump +alias hx='hexdump -C' + +# history +alias h="history | grep " + +# ip +ialias ip='ip -color=auto' +alias whatsmyip='curl -s ifconfig.me | xargs' +alias ipview="netstat -anpl | grep :80 | awk '{print $5}' | cut -d':' -f1 | sort | uniq -c | sort -n | sed -e 's/^ *//' -e 's/ *$//'" + +# killall +alias ka='killall' +alias k9='kill -9' +alias k15='kill -15' + +# logs +alias logs="sudo find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f" + +# ls: eza or built-in +[ -x "$(command -v eza)" ] && { + ialias l='eza --icons --group-directories-first' + ialias la='eza --icons -aa --group-directories-first' + ialias lh='eza --icons -aa --group-directories-first' + ialias ll='eza -gl --icons --group-directories-first' + ialias lla='eza -glaa --icons --group-directories-first' + ialias lm='eza -glA --group-directories-first | more' + ialias lr='eza --icons -R --group-directories-first' + ialias ls='eza --icons -A --group-directories-first' + ialias lsb='eza --icons -b --group-directories-first' + ialias lsby='eza --icons -B --group-directories-first' + ialias lld='eza --icons -Dl --group-directories-first' + ialias llda='eza --icons -aaDl --group-directories-first' + ialias llf='eza --icons -fl' + ialias llfa='eza --icons -aafl' + ialias llsa='eza --icons -l -s=accessed' + ialias llsaa='eza --icons -aal -s=accessed' + ialias llsc='eza --icons -l -s=created' + ialias llsca='eza --icons -aal -s=created' + ialias llse='eza --icons -l -s=extension' + ialias llsea='eza --icons -aal -s=extension' + ialias llsm='eza --icons -l -s=modified' + ialias llsma='eza --icons -aal -s=modified' + ialias llsn='eza --icons -l -s=name' + ialias llsna='eza --icons -aal -s=name' + ialias llss='eza --icons -l -s=size' + ialias llssa='eza --icons -aal -s=size' + ialias llst='eza --icons -l -s=type' + ialias llsta='eza --icons -aal -s=type' + ialias lt='eza --icons -T -L' + ialias ltd='eza --icons -TD -L' + ialias ltdr='eza --icons -TDr -L' + ialias ltr='eza --icons -Tr -L' +} || { + ialias l='/usr/bin/ls -h --color=always --group-directories-first' + ialias la='/usr/bin/ls -alh --color=always --group-directories-first' + ialias ll='/usr/bin/ls -lh --color=always --group-directories-first' + ialias lla='/usr/bin/ls -aFls --color=always --group-directories-first' + ialias llf='/usr/bin/ls -Fls --color=always --group-directories-first' + ialias lm='/usr/bin/ls -alh --color=always --group-directories-first | more' + ialias lr='/usr/bin/ls -hlR --color=always --group-directories-first' + ialias lra='/usr/bin/ls -ahlR --color=always --group-directories-first' + ialias ls='/usr/bin/ls -AFh --color=always --group-directories-first' + ialias llsa='/usr/bin/ls -hlru --color=always --group-directories-first' + ialias llsc='/usr/bin/ls -hclr --color=always --group-directories-first' + ialias lld='/usr/bin/ls -l --color=always | grep "^d"' + ialias llda='/usr/bin/ls -la --color=always | grep "^d"' + ialias llse='/usr/bin/ls -BhlX --color=always --group-directories-first' + ialias llsf='/usr/bin/ls -l --color=always | grep -v "^d"' + ialias llsfa='/usr/bin/ls -la --color=always | grep -v "^d"' + ialias llsm='/usr/bin/ls -hlr --time=ctime --color=always --group-directories-first' + ialias llsn='/usr/bin/ls -alp --color=always --group-directories-first' + ialias llss='/usr/bin/ls -hlrS --color=always --group-directories-first' + ialias llst='/usr/bin/ls -hlrt --color=always --group-directories-first' + ialias lw='/usr/bin/ls -Ahx --color=always --group-directories-first' +} + +# mime +alias mimereset="update-desktop-database ${XDG_DATA_HOME:-${HOME}/.local/share}/applications" + +# mkdir +ialias mkdir='mkdir -pv' + +# modified commands +alias grep="/usr/bin/grep $GREP_OPTIONS" +alias cp="cp -i" +alias freshclam="sudo freshclam" +alias less="less -R" +alias mkdir="mkdir -p" +alias multitail="multitail --no-repeat -c" +alias mv="mv -i" +alias ping="ping -c 10" +alias ps="ps auxf" +alias rm="rm -iv" +alias svi="sudo vi" +alias v="vim" +alias vi="vim" +alias vis="vim '+set si'" + +# move +ialias mv='mv -iv' + +# nginx +alias ngx="cd /etc/nginx" + +# nvim +alias v='$EDITOR' +alias v.='$EDITOR .' +alias ve='$EDITOR -c enew' +alias nv.='nvim .' +alias nve='nvim -c enew' +alias nts='NVIM_APPNAME=TheSiahxyz nvim' +alias nav='NVIM_APPNAME=AstroNvim nvim' +alias nlu='NVIM_APPNAME=LunarVim nvim' +alias nlv='NVIM_APPNAME=LazyVim nvim' +alias nnc='NVIM_APPNAME=NvChad nvim' +alias snv='sudo nvim' +alias vll='lastnvim -l' +alias vln='$EDITOR -c '\''execute "edit " . v:oldfiles[0] | normal ''0'\' + +# ports +alias openports="netstat -nape --inet" + +# ps +ialias ps='ps auxf' +alias psj='ps aux | grep "[j]ava"' +balias psg='ps auxf | grep' +alias topcpu='/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10' + +# python +alias py='python3' + +# realpath +alias rp='realpath' + +# remove +ialias rm='rm -vI' + +# rsync +alias rsc='rsync -vrazPlu' +alias rscd='rsync -vrazPlu --delete' +alias rscr='rsync -vrazPlu --remove-source-files' + +# rules +alias rrr='sudo udevadm control --reload-rules' + +# scp +ialias scp='scp -r' + +# sha1 +alias sha1='openssl sha1' + +# shell +alias tobash="sudo chsh $USER -s /bin/bash && 'Now log out.'" +alias tozsh="sudo chsh $USER -s /bin/zsh && 'Now log out.'" +alias tofish="sudo chsh $USER -s /bin/fish && 'Now log out.'" + +# shellcheck +alias shck='shellcheck --color=always' + +# shortcut +alias ref='shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutenvrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc' + +# sudo +alias su='sudo su -l root' +alias sm='setopt no_nomatch && rm -rf *.rej *.orig >/dev/null 2>&1' +alias smi='setopt no_nomatch && rm -rf *.rej *.orig >/dev/null 2>&1 && unsetopt no_nomatch; sudo make clean install; rm -f config.h' + +# suffix +alias -s {pdf,PDF}='background mupdf' +alias -s {jpg,JPG,png,PNG}='background gpicview' +alias -s {ods,ODS,odt,ODT,odp,ODP,doc,DOC,docx,DOCX,xls,XLS,xlsx,XLSX,xlsm,XLSM,ppt,PPT,pptx,PPTX,csv,CSV}='background libreoffice' +alias -s {html,HTML}='background chromium' +alias -s {mp4,MP4,mov,MOV,mkv,MKV}='background vlc' +alias -s {zip,ZIP,war,WAR}="unzip -l" +alias -s {jar,JAR}="java -jar" +alias -s gz="tar -tf" +alias -s {tgz,TGZ}="tar -tf" + +# tar +alias txf='tar -xf' +alias ttf='tar -tf' +alias mktar="tar -cvf" +alias mkbz2="tar -cvjf" +alias mkgz="tar -cvzf" +alias untar="tar -xvf" +alias unbz2="tar -xvjf" +alias ungz="tar -xvzf" + +# tmux +alias sts='tmux source $XDG_CONFIG_HOME/tmux/tmux.conf' +alias ta='tmux a' +alias tmc='tmuxcreate' +alias tmka='tmux kill-session -a' +alias tmls='tmux ls' +alias tmo='tmuxopen' +alias tmpk='command pkill tmux' +alias tm.='tmux new -s "$(basename $PWD)"' + +# tor +alias torh="cat /var/lib/tor/hidden_service/hostname" + +# trash +alias trd='trash-rm' +alias tre='trash-empty' +alias trl='trash-list' +alias trp='trash-put' +alias trr='trash-restore' + +# tree +ialias tree='tree -a -I ".svn|.git|.hg|.idea"' +alias tree2='tree -L 2' +alias tree3='tree -L 3' + +# unix +alias -g md='mkdir -p' +alias -g wh='which' +alias -g wt='while true; do' +alias -g s1='sleep 1' +alias -g s2='sleep 2' +alias -g s01='sleep 0.1' +alias -g s05='sleep 0.5' +alias -g A1="| awk '{print \$1}'" +alias -g L='| less' +alias -g H='| head' +alias -g H2='| head -n 20' +alias -g X='| xargs -I@' +alias -g C='| xclip -selection clipboard' +alias -g Fj='| jq .' +alias -g Fy='| yq .' +alias -g Fx='| xmllint --format -' +alias -g V='| nvim -' + +# unzip +alias uz='unzip' +alias uzl='unzip -l' + +# vim +alias vi='vim' +alias vi.='vim .' + +# watch +alias w1='watch -n 1' + +# wget +ialias wget --hsts-file="${XDG_CACHE_HOME:-${HOME}/.cache}/wget-hsts" + +# xprog +alias progn='xprop | awk '\''/^WM_CLASS/{sub(/.* = /, "instance:"); sub(/, /, "\nclass:"); print} /^WM_NAME/{sub(/.* = /, "title:"); print}'\''' + +# zsh +alias sps="source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/profile" +alias szs="source ${XDG_CONFIG_HOME:-${HOME}/.config}/zsh/.zshrc" diff --git a/fedora/.config/shell/bm-dirs b/fedora/.config/shell/bm-dirs new file mode 100644 index 0000000..2afa0b0 --- /dev/null +++ b/fedora/.config/shell/bm-dirs @@ -0,0 +1,37 @@ +# Keys Filename +bb ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin} +btp ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin}/tmux +bz ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin}/zsh +cac ${XDG_CACHE_HOME:-${HOME}/.cache} +cbc ${XDG_CONFIG_HOME:-${HOME}/.config}/bash +cfg ${XDG_CONFIG_HOME:-${HOME}/.config} +cgc ${XDG_CONFIG_HOME:-${HOME}/.config}/git +cnv ${XDG_CONFIG_HOME:-${HOME}/.config}/nvim +csh ${XDG_CONFIG_HOME:-${HOME}/.config}/shell +ctm ${XDG_CONFIG_HOME:-${HOME}/.config}/tmux +cts ${XDG_CONFIG_HOME:-${HOME}/.config}/TheSiahxyz +cvc ${XDG_CONFIG_HOME:-${HOME}/.config}/vim +czc ${XDG_CONFIG_HOME:-${HOME}/.config}/zsh +Esm /etc/samba +gdc ${XDG_DOCUMENTS_DIR:-${HOME}/Documents} +gdk ${XDG_DESKTOP_DIR:-${HOME}/Desktop} +gdn ${XDG_DOWNLOAD_DIR:-${HOME}/Downloads} +gdo ${XDG_DOTFILES_DIR:-${HOME}/.dotfiles} +gmu ${XDG_MUSIC_DIR:-${HOME}/Music} +gpb ${XDG_PUBLICSHARE_DIR:-${HOME}/Public} +gpp ${XDG_PICTURES_DIR:-${HOME}/Pictures} +gpv $HOME/Private +grr ${XDG_PICTURES_DIR:-${HOME}/Pictures}/resources +gss ${XDG_PICTURES_DIR:-${HOME}/Pictures}/screenshots +gvv ${XDG_VIDEOS_DIR:-${HOME}/Videos} +Hme /media/$USER +Hmt /mnt +pae ${PASSWORD_STORE_DIR:-$XDG_DATA_HOME/.password-store}/exported_keys +pah ${PASSWORD_STORE_DIR:-$XDG_DATA_HOME/.password-store}/ssh +pas ${PASSWORD_STORE_DIR:-$XDG_DATA_HOME/.password-store} +shh ${XDG_DATA_HOME:-${HOME}/.local/share}/history +shr ${XDG_DATA_HOME:-${HOME}/.local/share} +shv ${XDG_DATA_HOME:-${HOME}/.local/share}/venvs +sr ${XDG_SOURCES_HOME:-${HOME}/.local/src} +trs ${XDG_DATA_HOME:-${HOME}/.local/share}/Trash/files +tt ${XDG_STATE_HOME:-${HOME}/.local/state} diff --git a/fedora/.config/shell/bm-files b/fedora/.config/shell/bm-files new file mode 100644 index 0000000..0be00a6 --- /dev/null +++ b/fedora/.config/shell/bm-files @@ -0,0 +1,19 @@ +# Keys Filename Description +vbc ${XDG_CONFIG_HOME:-${HOME}/.config}/bash/bashrc # Bash (shell) config +vbd ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/bm-dirs # A list of bookmarked directories similar to this file +vbf ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/bm-files # This file, a list of bookmarked files +vbi ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/inputrc # This file is for gnu readline +vbp ${XDG_CONFIG_HOME:-${HOME}/.config}/bash/bash_profile # Bash profile +vga ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/git-aliasrc # Git aliases +vgc ${XDG_CONFIG_HOME:-${HOME}/.config}/git/config # Git config +vgi ${XDG_CONFIG_HOME:-${HOME}/.config}/git/ignore # Git ignore +Vsm /etc/samba/smb.conf # Samba config +vtm ${XDG_CONFIG_HOME:-${HOME}/.config}/tmux/tmux.conf # Tmux config +vvc ${XDG_CONFIG_HOME:-${HOME}/.config}/vim/vimrc # Vim config +vvi ${XDG_CONFIG_HOME:-${HOME}/.config}/vim/init.vim # Vim init +vvp ${XDG_CONFIG_HOME:-${HOME}/.config}/vim/plugins.vim # Vim plugins +vza ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/aliasrc # Aliases used by zsh (and potentially other shells) +vzc ${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/.zshrc # Zsh config +vzk ${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/keymaps.zsh # Zsh keymaps +vzp ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/profile # Zsh profile used for system +vzs ${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/scripts.zsh # Zsh scripts diff --git a/fedora/.config/shell/git-aliasrc b/fedora/.config/shell/git-aliasrc new file mode 100644 index 0000000..f87a556 --- /dev/null +++ b/fedora/.config/shell/git-aliasrc @@ -0,0 +1,415 @@ +# Git version checking +autoload -Uz is-at-least +git_version="${${(As: :)$(git version 2>/dev/null)}[3]}" + +# +# Functions Current +# (sorted alphabetically by function name) +# (order should follow README) +# + +# The name of the current branch +# Back-compatibility wrapper for when this function was defined here in +# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() +# to fix the core -> git plugin dependency. +current_branch() { + git_current_branch +} + +# Check for develop and similarly named branches +git_develop_branch() { + command git rev-parse --git-dir &>/dev/null || return + local branch + for branch in dev devel develop development; do + if command git show-ref -q --verify refs/heads/$branch; then + echo $branch + return 0 + fi + done + + echo develop + return 1 +} + +# Check if main exists and use instead of master +git_main_branch() { + command git rev-parse --git-dir &>/dev/null || return + local ref + for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,master}; do + if command git show-ref -q --verify $ref; then + echo ${ref:t} + return 0 + fi + done + + # If no main branch was found, fall back to master but return error + echo master + return 1 +} + +grename() { + if [[ -z "$1" || -z "$2" ]]; then + echo "Usage: $0 old_branch new_branch" + return 1 + fi + + # Rename branch locally + git branch -m "$1" "$2" + # Rename branch in origin remote + if git push origin :"$1"; then + git push --set-upstream origin "$2" + fi +} + +# +# Functions Work in Progress (WIP) +# (sorted alphabetically by function name) +# (order should follow README) +# + +# Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one +gunwipall() { + local _commit=$(git log --grep='--wip--' --invert-grep --max-count=1 --format=format:%H) + + # Check if a commit without "--wip--" was found and it's not the same as HEAD + if [[ "$_commit" != "$(git rev-parse HEAD)" ]]; then + git reset $_commit || return 1 + fi +} + +# Warn if the current branch is a WIP +work_in_progress() { + command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!" +} + +# +# Aliases +# (sorted alphabetically by command) +# (order should follow README) +# (in some cases force the alisas order to match README, like for example gke and gk) +# + +alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' + +ggpnp() { + if [[ "$#" == 0 ]]; then + ggl && ggp + else + ggl "${*}" && ggp "${*}" + fi +} +compdef _git ggpnp=git-checkout + +alias ggpur='ggu' +alias g='git' +! pidof transmission-daemon >/dev/null && alias gaa='git add --all' || alias gaa='echo "Turn off transmission-daemon first!"' +alias gapa='git add --patch' +alias gau='git add --update' +alias gav='git add --verbose' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' +alias gam='git am' +alias gama='git am --abort' +alias gamc='git am --continue' +alias gamscp='git am --show-current-patch' +alias gams='git am --skip' +alias gap='git apply' +alias gapt='git apply --3way' +alias gbs='git bisect' +alias gbsb='git bisect bad' +alias gbsg='git bisect good' +alias gbsn='git bisect new' +alias gbso='git bisect old' +alias gbsr='git bisect reset' +alias gbss='git bisect start' +alias gb='git branch' +alias gba='git branch --all' +alias gbD='git branch --delete --force' + +gbda() { + git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null +} + +# Copied and modified from James Roeder (jmaroeder) under MIT License +# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish +gbds() { + local default_branch=$(git_main_branch) + (( ! $? )) || default_branch=$(git_develop_branch) + + git for-each-ref refs/heads/ "--format=%(refname:short)" | \ + while read branch; do + local merge_base=$(git merge-base $default_branch $branch) + if [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch\^{tree}) -p $merge_base -m _)) = -* ]]; then + git branch -D $branch + fi + done +} + +alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d' +alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D' +alias gbm='git branch --move' +alias gbnm='git branch --no-merged' +alias gbr='git branch --remote' +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' +alias gbg='LANG=C git branch -vv | grep ": gone\]"' +alias gcor='git checkout --recurse-submodules' +alias gcB='git checkout -B' +alias gcd='git checkout $(git_develop_branch)' +alias gcm='git checkout $(git_main_branch)' +alias gcpa='git cherry-pick --abort' +alias gcpc='git cherry-pick --continue' +alias gcl='git clone --recurse-submodules' + +gccd() { + setopt localoptions extendedglob + + # get repo URI from args based on valid formats: https://git-scm.com/docs/git-clone#URLS + local repo='${${@[(r)(ssh://*|git://*|ftp(s)#://*|http(s)#://*|*@*)(.git/#)#]}:-$_}' + + # clone repository and exit if it fails + command git clone --recurse-submodules "$@" || return + + # if last arg passed was a directory, that's where the repo was cloned + # otherwise parse the repo URI and use the last part as the directory + [[ -d "$_" ]] && cd '$_' || cd '${${repo:t}%.git/#}' +} +compdef _git gccd=git-clone + +alias gcam='git commit --all --message' +alias gcas='git commit --all --signoff' +alias gcasm='git commit --all --signoff --message' +alias gcs='git commit --gpg-sign' +alias gcss='git commit --gpg-sign --signoff' +alias gcssm='git commit --gpg-sign --signoff --message' +alias gcmsg='git commit --message' +alias gcsm='git commit --signoff --message' +alias gc='git commit --verbose' +alias gca='git commit --verbose --all' +alias gca!='git commit --verbose --all --amend' +alias gcan!='git commit --verbose --all --no-edit --amend' +alias gcans!='git commit --verbose --all --signoff --no-edit --amend' +alias gc!='git commit --verbose --amend' +alias gcn!='git commit --verbose --no-edit --amend' +alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' +alias gdca='git diff --cached' +alias gdcw='git diff --cached --word-diff' +alias gds='git diff --staged' +alias gdw='git diff --word-diff' + +gdv() { git diff -w "$@" | view - } +compdef _git gdv=git-diff + +alias gdup='git diff @{upstream}' + +gdnolock() { + git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock" +} +compdef _git gdnolock=git-diff + +alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gf='git fetch' +# --jobs=<n> was added in git 2.8 +is-at-least 2.8 "$git_version" \ + && alias gfa='git fetch --all --prune --jobs=10' \ + || alias gfa='git fetch --all --prune' +alias gfo='git fetch origin' +alias gg='git gui citool' +alias gga='git gui citool --amend' +alias ghh='git help' +alias glgg='git log --graph' +alias glggp='git log --graph --parents' +alias glgga='git log --graph --decorate --all' +alias glggpa='git log --graph --decorate --parents --all' +alias glgm='git log --graph --max-count=10' +alias glgpm='git log --graph --parents --max-count=10' +alias gloac='git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%ae>%Creset" --abbrev-commit --all' +alias glods='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short' +alias glopds='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --parents --date=short' +alias glod='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"' +alias glopd='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --parents' +alias glola='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all' +alias glolpa='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --parents --all' +alias glols='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat' +alias glolps='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --parents --stat' +alias glol='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"' +alias glolp='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --parents' +alias glog='git log --oneline --decorate --graph' +alias glogp='git log --oneline --decorate --graph --parents' +alias gloga='git log --oneline --decorate --graph --all' +alias glogpa='git log --oneline --decorate --graph --parents --all' + +# Pretty log messages +_git_log_prettily(){ + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +compdef _git _git_log_prettily=git-log + +alias glp='_git_log_prettily' +alias glg='git log --stat' +alias glgp='git log --stat --patch' +alias gignored='git ls-files -v | grep "^[[:lower:]]"' +alias gfg='git ls-files | grep' +alias gm='git merge' +alias gma='git merge --abort' +alias gms="git merge --squash" +alias gmom='git merge origin/$(git_main_branch)' +alias gmum='git merge upstream/$(git_main_branch)' +alias gmtl='git mergetool --no-prompt' +alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' + +alias gl='git pull' +alias gprb='git pull --rebase' +alias gprbv='git pull --rebase -v' +alias gpra='git pull --rebase --autostash' +alias gprav='git pull --rebase --autostash -v' + +ggu() { + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git pull --rebase origin "${b:=$1}" +} +compdef _git ggu=git-checkout + +alias gprom='git pull --rebase origin $(git_main_branch)' +alias gpromi='git pull --rebase=interactive origin $(git_main_branch)' +alias ggpull='git pull origin "$(git_current_branch)"' + +ggl() { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git pull origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git pull origin "${b:=$1}" + fi +} +compdef _git ggl=git-checkout + +alias gluc='git pull upstream $(git_current_branch)' +alias glum='git pull upstream $(git_main_branch)' +# alias gp='git push' +alias gpd='git push --dry-run' + +ggf() { + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force origin "${b:=$1}" +} +compdef _git ggf=git-checkout + +alias gpf!='git push --force' +is-at-least 2.30 "$git_version" \ + && alias gpf='git push --force-with-lease --force-if-includes' \ + || alias gpf='git push --force-with-lease' + +ggfl() { + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force-with-lease origin "${b:=$1}" +} +compdef _git ggfl=git-checkout + +alias gpsup='git push --set-upstream origin $(git_current_branch)' +is-at-least 2.30 "$git_version" \ + && alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes' \ + || alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease' +alias gpvb='git push --verbose' +alias gpoat='git push origin --all && git push origin --tags' +alias gpod='git push origin --delete' +alias ggpush='git push origin "$(git_current_branch)"' + +ggp() { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git push origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git push origin "${b:=$1}" + fi +} +compdef _git ggp=git-checkout + +alias gpu='git push upstream' +alias grba='git rebase --abort' +alias grbc='git rebase --continue' +alias grbi='git rebase --interactive' +alias grbo='git rebase --onto' +alias grbs='git rebase --skip' +alias grbd='git rebase $(git_develop_branch)' +alias grbm='git rebase $(git_main_branch)' +alias grbom='git rebase origin/$(git_main_branch)' +alias gr='git remote' +alias grv='git remote --verbose' +alias gra='git remote add' +alias grrm='git remote remove' +alias grmv='git remote rename' +alias grset='git remote set-url' +alias grup='git remote update' +alias gru='git reset --' +alias grhh='git reset --hard' +alias grhk='git reset --keep' +alias grhs='git reset --soft' +alias gpristine='git reset --hard && git clean --force -dfx' +alias groh='git reset origin/$(git_current_branch) --hard' +alias grs='git restore' +alias grss='git restore --source' +alias grst='git restore --staged' +alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1' +alias grev='git revert' +alias grm='git rm' +alias grmc='git rm --cached' +alias gcount='git shortlog --summary --numbered' +alias gsh='git show' +alias gsps='git show --pretty=short --show-signature' +alias gstall='git stash --all' +alias gstaa='git stash apply' +alias gstc='git stash clear' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +# use the default stash push on git 2.13 and newer +is-at-least 2.13 "$git_version" \ + && alias gsta='git stash push' \ + || alias gsta='git stash save' +alias gsts='git stash show --patch' +alias gst='git status' +alias gsb='git status --short --branch' +alias gsi='git submodule init' +alias gsu='git submodule update' +alias gsd='git svn dcommit' +alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' +alias gsr='git svn rebase' +alias gsw='git switch' +alias gswc='git switch --create' +alias gswd='git switch $(git_develop_branch)' +alias gswm='git switch $(git_main_branch)' +alias gtan='git tag --annotate' +alias gtsn='git tag --sign' +alias gtv='git tag | sort -V' +alias gignore='git update-index --assume-unchanged' +alias gunignore='git update-index --no-assume-unchanged' +alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +alias gwt='git worktree' +alias gwta='git worktree add' +alias gwtls='git worktree list' +alias gwtmv='git worktree move' +alias gwtrm='git worktree remove' +alias gstu='gsta --include-untracked' +alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl' +alias gk='\gitk --all --branches &!' +alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!' + +unset git_version + +# Logic for adding warnings on deprecated aliases +local old_alias new_alias +for old_alias new_alias ( + # TODO(2023-10-19): remove deprecated `git pull --rebase` aliases + gup gpr + gupv gprv + gupa gpra + gupav gprav + gupom gprom + gupomi gpromi +); do + aliases[$old_alias]=' + print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\" + $new_alias' +done +unset old_alias new_alias diff --git a/fedora/.config/shell/inputrc b/fedora/.config/shell/inputrc new file mode 100644 index 0000000..81cdf85 --- /dev/null +++ b/fedora/.config/shell/inputrc @@ -0,0 +1,31 @@ +$include /etc/inputrc + +set completion-display-width 0 +set completion-query-items 1000 + +# Prettyfi +set colored-stats on +set colored-completion-prefix on + +# ^C no longer shows on C-c keypress +set echo-control-characters off + +# Map tab to cycle through all the possible completions. +TAB: menu-complete + +# vi mode +set editing-mode vi + +$if mode=vi +set show-mode-in-prompt on +set vi-ins-mode-string \1\e[6 q\2 +set vi-cmd-mode-string \1\e[2 q\2 +set keymap vi-command + +# these are for vi-command mode +Control-l: clear-screen + +set keymap vi-insert +# these are for vi-insert mode +Control-l: clear-screen +$endif diff --git a/fedora/.config/shell/profile b/fedora/.config/shell/profile new file mode 100644 index 0000000..677943a --- /dev/null +++ b/fedora/.config/shell/profile @@ -0,0 +1,151 @@ +################################################### +### --- PROFILE --- ### +################################################### +[ "$(tty)" = "/dev/tty1" ] && set -e # Exit immediately if a command exits with a non-zero status. + +################################################### +### --- ENV PATH --- ### +################################################### +# Add all directories in each subdirectory to $PATH +export PATH="$PATH:$(find ~/.local/bin -path '*/.git*' -prune -o \( -type f -o -type l \) -perm -u=x -exec dirname {} \; | sort -u | paste -sd ':' -)" +export PATH="$PATH:$(find ~/.local/share/.password-store -type d -name '.extensions' | paste -sd ':' -)" +command -v asdf >/dev/null 2>&1 && export PATH="$PATH:$(find -L ~/.local/share/asdf/installs -name bin -type d -print 2>/dev/null | sort -u | paste -s -d ':' -)" +command -v npm >/dev/null 2>&1 && export PATH="$PATH:$(find -L ~/.local/share/npm -name bin -type d -print 2>/dev/null | sort -u | paste -s -d ':' -)" + +unsetopt PROMPT_SP 2>/dev/null + +################################################### +### --- DEFAULT PROGRAMS --- ### +################################################### +export EDITOR="nvim" +export EDITOR2="vim" +# export FILE_MANAGER="lf $(lf -version)" +export KEYTIMEOUT=10 +export SUDO_EDITOR=$EDITOR +export TERM="xterm-256color" +export VISUAL=$EDITOR + +################################################### +### --- XDG ENV PATHES --- ### +################################################### +### --- XDG DEFAULT --- ### +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" + +### --- XDG CUSTOMS --- ### +export XDG_DOTFILES_DIR="$HOME/.dotfiles" +export XDG_SCRIPTS_HOME="$HOME/.local/bin" +export XDG_SOURCES_HOME="$HOME/.local/src" +export XDG_DESKTOP_DIR="$HOME/Desktop" +export XDG_DOCUMENTS_DIR="$HOME/Documents" +export XDG_DOWNLOAD_DIR="$HOME/Downloads" +export XDG_MUSIC_DIR="$HOME/Music" +export XDG_PICTURES_DIR="$HOME/Pictures" +export XDG_PUBLICSHARE_DIR="$HOME/Public" +export XDG_TEMPLATES_DIR="$HOME/Templates" +export XDG_VIDEOS_DIR="$HOME/Videos" + +################################################### +### --- DEFAULT ENV PATHES FOR ALL PROGRAMS --- ### +################################################### +### --- ANDROID --- ### +export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android" + +### --- ANSIBLE --- ### +export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg" + +### --- BAT --- ### +export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config" + +### --- CARGO --- ### +export CARGO_HOME="$XDG_DATA_HOME/cargo" + +### --- DICS --- ### +export DICS="/usr/share/stardict/dic/" + +### --- ELECTRUM --- ### +export ELECTRUMDIR="$XDG_DATA_HOME/electrum" + +### --- HISTORY --- ### +export HISTFILE="$XDG_DATA_HOME/history/sh_history" + +### --- INPUTRC --- ### +export INPUTRC="$XDG_CONFIG_HOME/shell/inputrc" + +### --- JAVA --- ### +export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname +export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm + +### --- MANPAGER --- ### +([ -x "$(command -v batcat)" ] || [ -x "$(command -v batman)" ]) && { + export MANPAGER="sh -c 'col -bx | bat -l man -p'" + export MANROFFOPT="-c" +} || { + export MANPAGER='less -s' + export LESS="R" + export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" + export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" + export LESS_TERMCAP_me="$(printf '%b' '[0m')" + export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')" + export LESS_TERMCAP_se="$(printf '%b' '[0m')" + export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" + export LESS_TERMCAP_ue="$(printf '%b' '[0m')" + export LESSOPEN="| lesspipe.sh %s" +} + +### --- NPM --- ### +export NPM_CONFIG_USERCONFIG="~/.config/npm/.npmrc" + +### --- NVM --- ### +export NVM_DIR="$XDG_CONFIG_HOME/nvm" + +### --- PASSWORD STORE --- ### +export PASSWORD_STORE_DIR="$XDG_DATA_HOME/.password-store" +export PASSWORD_STORE_CLIP_TIME=180 # Specifies the number of seconds to wait before restoring the clipboard, by default 45 seconds. +# export PASSWORD_STORE_GENERATED_LENGTH=18 # by default 25. +# export PASSWORD_STORE_CHARACTER_SET='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[]{};:,.<>?' +# export PASSWORD_STORE_CHARACTER_SET_NO_SYMBOLS='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[]{};:,.<>?' +export PASSWORD_STORE_ENABLE_EXTENSIONS="true" +# export PASSWORD_STORE_EXTENSIONS_DIR="$PASSWORD_STORE_DIR/.extensions" +# export BASH_COMPLETION_USER_DIR=$XDG_DATA_HOME/bash-completion/completions + +### --- POWERLEVEL10K --- ### +export POWERLEVEL9K_INSTALLATION_DIR="/usr/share/zsh-theme-powerlevel10k" + +### --- PYTHON --- ### +export PYTHONPYCACHEPREFIX=$XDG_CACHE_HOME/python +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" + +### --- RUST --- ### +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" + +### --- SQLITE --- ### +export SQLITE_HISTORY="$XDG_DATA_HOME/history/sqlite_history" + +### --- TMUX --- ### +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" + +### --- VIM --- ### +# export GVIMINIT='let $MYGVIMRC = !has("nvim") ? "$XDG_CONFIG_HOME/vim/gvimrc" : "$XDG_CONFIG_HOME/nvim/init.lua" | so $MYGVIMRC' +# export VIMINIT='let $MYVIMRC = !has("nvim") ? "$XDG_CONFIG_HOME/vim/vimrc" : "$XDG_CONFIG_HOME/nvim/init.lua" | so $MYVIMRC' + +### --- VIRTUAL ENVIRONMENT --- ### +export WORKON_HOME="$XDG_DATA_HOME/venvs" + +### --- VISUAL STUDIO CODE --- ### +export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode" + +### --- WGET --- ### +export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" + +### --- ZSH --- ### +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export ZPLUGINDIR="$XDG_SCRIPTS_HOME/zsh" + +### --- SHORTCUTS --- ### +[ ! -f "$XDG_CONFIG_HOME/shell/shortcutrc" ] && setsid -f shortcuts >/dev/null 2>&1 + +### --- LAPTOP KEYMAP --- ### +sudo -n loadkeys "$XDG_DATA_HOME/thesiah/ttymaps.kmap" 2>/dev/null diff --git a/fedora/.config/shell/scripts.bash b/fedora/.config/shell/scripts.bash new file mode 100644 index 0000000..f257809 --- /dev/null +++ b/fedora/.config/shell/scripts.bash @@ -0,0 +1,54 @@ +#!/bin/bash + +########################################################################################### +########################################################################################### +### --- COMMAND OUTPUT --- ### +alias ilco=insert_last_command_output +insert_last_command_output() { + local last_cmd + last_cmd=$(history | tail -n 2 | head -n 1 | sed 's/^[ ]*[0-9]\+[ ]*//') + eval "$last_cmd" +} + +########################################################################################### +########################################################################################### +### --- CREATE --- ### +alias mc=mkcd +mkcd() { mkdir -p "$1" && cd "$1" || return; } + +mkdt() { + mkdir -p "${1:+$1/}$(date +%F)" +} + +########################################################################################### +########################################################################################### +### --- PASS --- ### +pass_otp() { pass otp uri -q "$1"; } +pass_otp_insert() { pass otp insert "$1"; } + +alias cpqr=pass_qr +pass_qr() { qrencode -o "$1.png" -t png -Sv 40 < "$1.pgp"; } + +########################################################################################### +########################################################################################### +### --- STOW --- ### +alias dstw=dotfiles_stw +dotfiles_stw() { + "${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/$(whereami)/.local/bin/stw" +} + +########################################################################################### +########################################################################################### +### --- SUDO --- ### +pre_cmd() { + local prepend_command="$1" + local buffer="${READLINE_LINE:-}" + + if [ -z "$buffer" ]; then + buffer=$(history | tail -n 2 | head -n 1 | sed 's/^[ ]*[0-9]\+[ ]*//') + fi + + READLINE_LINE="$prepend_command $buffer" + READLINE_POINT=${#READLINE_LINE} +} +bind -x '"\es":pre_cmd sudo' |
