.zshrc
· 3.8 KiB · Bash
Raw
# Custom zshrc for my setup, this mostly has extra docker aliases and a list of plugins.
# This will go with my zsh installer script.
# Enable this if using a custom welcome message for SSH/user login.
# https://stackoverflow.com/questions/22913551/how-to-run-profile-inside-a-shell-script-in-ubuntu
# bash /etc/update-motd.d/5-welcome.sh
#-------------
# Default ZSH settings
#-------------
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
plugins=(
command-not-found
extract
deno
docker
git
github
gitignore
history-substring-search
node
npm
nvm
yarn
volta
vscode
sudo
web-search
z
zsh-autosuggestions
zsh-syntax-highlighting
ohmyzsh-full-autoupdate
)
source $ZSH/oh-my-zsh.sh
#-------------
# User configuration
#-------------
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
#-------------
# Aliases
#-------------
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
# Add docker aliases
alias dcu='docker compose up -d'
alias dcp='docker compose pull'
alias dcs='docker compose stop'
alias dcrm='docker compose rm'
alias dcub='docker compose up --build -d'
# New for docker
# Display the IP of a container
# https://stackoverflow.com/questions/17157721/how-to-get-a-docker-containers-ip-address-from-the-host
alias dcnet='docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1'
# Stop, remove, update and start a container back up.
alias dcup='docker compose stop && docker compose rm -f && docker compose pull && docker compose up --force-recreate -d'
# This is for gpg, I'm quite sure it is for making the password prompt show up in the terminal.
export GPG_TTY=$(tty)
alias update='sudo apt update && sudo apt upgrade -y --autoremove'
# Find total amount of files in a folder.
alias findcnt='find . | wc -l'
# Shortcut for downloading youtube videos and music with yt-dlp
# yt-dlp is required for these.
alias ytvideo-download='yt-dlp -o "%(title)s.%(ext)s" -f bestvideo+bestaudio/best'
alias ytmusic-download='yt-dlp -o "%(title)s.%(ext)s" -f bestaudio\[ext=m4a\]'
# Add path
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin:$PATH
# Make spaced commands not show in zsh history
# https://superuser.com/questions/352788/how-to-prevent-a-command-in-the-zshell-from-being-saved-into-history
setopt HIST_IGNORE_SPACE
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
| 1 | # Custom zshrc for my setup, this mostly has extra docker aliases and a list of plugins. |
| 2 | |
| 3 | # This will go with my zsh installer script. |
| 4 | |
| 5 | # Enable this if using a custom welcome message for SSH/user login. |
| 6 | # https://stackoverflow.com/questions/22913551/how-to-run-profile-inside-a-shell-script-in-ubuntu |
| 7 | # bash /etc/update-motd.d/5-welcome.sh |
| 8 | |
| 9 | #------------- |
| 10 | # Default ZSH settings |
| 11 | #------------- |
| 12 | |
| 13 | # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. |
| 14 | # Initialization code that may require console input (password prompts, [y/n] |
| 15 | # confirmations, etc.) must go above this block; everything else may go below. |
| 16 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then |
| 17 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" |
| 18 | fi |
| 19 | |
| 20 | # If you come from bash you might have to change your $PATH. |
| 21 | # export PATH=$HOME/bin:/usr/local/bin:$PATH |
| 22 | |
| 23 | # Path to your oh-my-zsh installation. |
| 24 | export ZSH="$HOME/.oh-my-zsh" |
| 25 | |
| 26 | # Set name of the theme to load |
| 27 | ZSH_THEME="powerlevel10k/powerlevel10k" |
| 28 | |
| 29 | # Uncomment one of the following lines to change the auto-update behavior |
| 30 | # zstyle ':omz:update' mode disabled # disable automatic updates |
| 31 | # zstyle ':omz:update' mode auto # update automatically without asking |
| 32 | # zstyle ':omz:update' mode reminder # just remind me to update when it's time |
| 33 | |
| 34 | # Uncomment the following line to change how often to auto-update (in days). |
| 35 | # zstyle ':omz:update' frequency 13 |
| 36 | |
| 37 | plugins=( |
| 38 | command-not-found |
| 39 | extract |
| 40 | deno |
| 41 | docker |
| 42 | git |
| 43 | github |
| 44 | gitignore |
| 45 | history-substring-search |
| 46 | node |
| 47 | npm |
| 48 | nvm |
| 49 | yarn |
| 50 | volta |
| 51 | vscode |
| 52 | sudo |
| 53 | web-search |
| 54 | z |
| 55 | zsh-autosuggestions |
| 56 | zsh-syntax-highlighting |
| 57 | ohmyzsh-full-autoupdate |
| 58 | ) |
| 59 | |
| 60 | |
| 61 | source $ZSH/oh-my-zsh.sh |
| 62 | |
| 63 | #------------- |
| 64 | # User configuration |
| 65 | #------------- |
| 66 | |
| 67 | # export MANPATH="/usr/local/man:$MANPATH" |
| 68 | |
| 69 | # You may need to manually set your language environment |
| 70 | # export LANG=en_US.UTF-8 |
| 71 | |
| 72 | # Preferred editor for local and remote sessions |
| 73 | # if [[ -n $SSH_CONNECTION ]]; then |
| 74 | # export EDITOR='vim' |
| 75 | # else |
| 76 | # export EDITOR='mvim' |
| 77 | # fi |
| 78 | |
| 79 | #------------- |
| 80 | # Aliases |
| 81 | #------------- |
| 82 | |
| 83 | # Set personal aliases, overriding those provided by oh-my-zsh libs, |
| 84 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh |
| 85 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. |
| 86 | # For a full list of active aliases, run `alias`. |
| 87 | |
| 88 | # Add docker aliases |
| 89 | alias dcu='docker compose up -d' |
| 90 | alias dcp='docker compose pull' |
| 91 | alias dcs='docker compose stop' |
| 92 | alias dcrm='docker compose rm' |
| 93 | alias dcub='docker compose up --build -d' |
| 94 | |
| 95 | # New for docker |
| 96 | # Display the IP of a container |
| 97 | # https://stackoverflow.com/questions/17157721/how-to-get-a-docker-containers-ip-address-from-the-host |
| 98 | alias dcnet='docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1' |
| 99 | |
| 100 | # Stop, remove, update and start a container back up. |
| 101 | alias dcup='docker compose stop && docker compose rm -f && docker compose pull && docker compose up --force-recreate -d' |
| 102 | |
| 103 | # This is for gpg, I'm quite sure it is for making the password prompt show up in the terminal. |
| 104 | export GPG_TTY=$(tty) |
| 105 | |
| 106 | alias update='sudo apt update && sudo apt upgrade -y --autoremove' |
| 107 | |
| 108 | # Find total amount of files in a folder. |
| 109 | alias findcnt='find . | wc -l' |
| 110 | |
| 111 | # Shortcut for downloading youtube videos and music with yt-dlp |
| 112 | # yt-dlp is required for these. |
| 113 | alias ytvideo-download='yt-dlp -o "%(title)s.%(ext)s" -f bestvideo+bestaudio/best' |
| 114 | alias ytmusic-download='yt-dlp -o "%(title)s.%(ext)s" -f bestaudio\[ext=m4a\]' |
| 115 | |
| 116 | # Add path |
| 117 | export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin:$PATH |
| 118 | |
| 119 | # Make spaced commands not show in zsh history |
| 120 | # https://superuser.com/questions/352788/how-to-prevent-a-command-in-the-zshell-from-being-saved-into-history |
| 121 | setopt HIST_IGNORE_SPACE |
| 122 | |
| 123 | # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. |
| 124 | [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |