Last active
November 11, 2022 23:33
-
-
Save Jaid/1b2dfe2cd4dca4e031a892e70a317ae7 to your computer and use it in GitHub Desktop.
My custom .zshrc template to quickly set up Debian server profiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ -f ~/.env ]]; then | |
source <(/usr/bin/bash ~/.env) | |
fi | |
if [[ -f ~/.path ]]; then | |
source <(/usr/bin/bash ~/.path) | |
fi | |
if [[ -f ~/.secrets ]]; then | |
source <(/usr/bin/bash ~/.secrets) | |
fi | |
: "${otherReposFolder:="$HOME/project/otherGit"}" | |
if ! $skipNeofetch; then | |
if [[ -d $otherReposFolder/neofetch ]]; then | |
( | |
nerd_font=on bash $otherReposFolder/neofetch/neofetch --title_fqdn on --kernel_shorthand on --memory_percent on --memory_unit gib --cpu_temp C --underline_char --kernel_shorthand off --block_width 4 --memory_display on --cpu_cores physical --speed_shorthand on & | |
) | |
fi | |
fi | |
if [[ -x $(command -v grcat) ]]; then | |
hasGrcat=true | |
else | |
hasGrcat=false | |
fi | |
if [[ $OS = Windows_NT ]]; then | |
isWindows=true | |
else | |
isWindows=false | |
fi | |
if $isWindows; then | |
function sudo() { | |
printf '[90mRemoving sudo instruction(B[m\n' >&2 | |
"$@" | |
} | |
fi | |
export ZSH="$otherReposFolder/ohmyzsh" | |
if [[ -d $ZSH/custom/themes/jaidnoster ]]; then | |
ZSH_THEME=jaidnoster | |
else | |
ZSH_THEME=agnoster | |
fi | |
# Don't ask, just update | |
zstyle ':omz:update' mode auto | |
# Based on https://unix.stackexchange.com/a/273863 | |
HISTSIZE=1000000 | |
SAVEHIST=$HISTSIZE | |
setopt INC_APPEND_HISTORY | |
setopt EXTENDED_HISTORY | |
setopt SHARE_HISTORY | |
setopt HIST_IGNORE_DUPS | |
setopt HIST_REDUCE_BLANKS | |
interactiveTools=( | |
ssh | |
nano | |
htop | |
ctop | |
ncdu | |
nethogs | |
) | |
ZSH_COMMAND_TIME_MIN_SECONDS=15 | |
ZSH_COMMAND_TIME_EXCLUDE=$interactiveTools | |
zbell_ignore=$interactiveTools | |
plugins=( | |
command-not-found | |
) | |
if [[ -d $ZSH/custom/plugins/command-time ]]; then | |
plugins+=(command-time) | |
fi | |
if [[ -d $ZSH/custom/plugins/you-should-use ]]; then | |
plugins+=(you-should-use) | |
fi | |
if [[ -d $ZSH/custom/plugins/zsh-autocomplete ]]; then | |
plugins+=(zsh-autocomplete) | |
zstyle ':autocomplete:*' min-delay 0.5 | |
zstyle ':autocomplete:*' min-input 1 | |
zstyle ':autocomplete:*' recent-dirs no | |
zstyle ':autocomplete:history-search:*' list-lines 5 | |
fi | |
if [[ -d $ZSH/custom/plugins/zsh-syntax-highlighting ]]; then | |
plugins+=(zsh-syntax-highlighting) | |
fi | |
if [[ -d $ZSH/custom/plugins/zsh-autosuggestions ]]; then | |
plugins+=(zsh-autosuggestions) | |
fi | |
if [[ -x $(command -v docker) ]]; then | |
plugins+=(docker) | |
plugins+=(docker-compose) | |
plugins+=("${plugins[@]}") | |
zstyle ':completion:*:*:docker:*' option-stacking yes | |
zstyle ':completion:*:*:docker-*:*' option-stacking yes | |
fi | |
if [[ -d $ZSH/custom/plugins/jaid ]]; then | |
plugins+=(jaid) | |
fi | |
source "$ZSH/oh-my-zsh.sh" | |
if [[ -x $(command -v lsblk+) ]]; then | |
alias blk=lsblk+ | |
fi | |
if [[ -x $(command -v ls+) ]]; then | |
alias l=ls+ | |
fi | |
if [[ -x $(command -v cp+) ]]; then | |
alias copy=cp+ | |
fi | |
if [[ -x $(command -v rm+) ]]; then | |
alias remove=rm+ | |
fi | |
if [[ -x $(command -v fd) ]]; then | |
alias fd+='fd --hidden' | |
fi | |
if [[ -x $(command -v ffmpeg) ]]; then | |
alias mpeg='ffmpeg -strict experimental -hide_banner -y' | |
fi | |
if [[ -x $(command -v ffprobe) ]]; then | |
alias probe='ffprobe -strict experimental -hide_banner -y' | |
fi | |
if [[ -x $(command -v uptime) ]]; then | |
if $hasGrcat; then | |
alias upt+='uptime | grcat conf.uptime' | |
fi | |
fi | |
if [[ -x $(command -v env+) ]]; then | |
alias e='env+' | |
fi | |
if [[ -x $(command -v ps) ]]; then | |
if $hasGrcat; then | |
function p() { | |
sudo ps "$@" | grcat conf.ps | |
} | |
else | |
alias p='sudo ps' | |
fi | |
fi | |
if [[ -x $(command -v npm) ]]; then | |
alias i='npm install --fund=false' | |
alias a='npm install --save' | |
alias ad='npm install --save-dev' | |
alias ag='npm install --global' | |
fi | |
if [[ -x $(command -v ncu) ]]; then | |
alias 'up?'=ncu | |
alias 'up??'='ncu --target greatest' | |
alias upf=upFilter | |
fi | |
if [[ -x $(command -v open-project-cli) ]]; then | |
alias o=open-project-cli | |
fi | |
if [[ -x $(command -v new-project-cli) ]]; then | |
alias new=new-project-cli | |
fi | |
if [[ -x $(command -v git-flush-cli) ]]; then | |
alias push=git-flush-cli | |
fi | |
if [[ -x $(command -v open-repo-cli) ]]; then | |
alias g=open-repo-cli | |
alias gn="open-repo-cli npm" | |
fi | |
if [[ $TERM_PROGRAM = vscode ]]; then | |
source "$(code --locate-shell-integration-path zsh)" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- target: .zshrc | |
userHome: true | |
backupExisting: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment