Last active 4 months ago

My custom .zshrc file for the zsh installer script

Revision cb6c715d5cd15dda7a995382434351a223958b13

.zshrc Raw
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 once I set it up
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.
16if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
17 source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
18fi
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.
24export ZSH="$HOME/.oh-my-zsh"
25
26# Set name of the theme to load
27ZSH_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
37plugins=(
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
61source $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
89alias dcu='docker compose up -d'
90alias dcp='docker compose pull'
91alias dcs='docker compose stop'
92alias dcrm='docker compose rm'
93alias 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
98alias dcnet='docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1'
99
100# Stop, remove, update and start a container back up.
101alias 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.
104export GPG_TTY=$(tty)
105
106alias update='sudo apt update && sudo apt upgrade -y --autoremove'
107
108# Find total amount of files in a folder.
109alias findcnt='find . | wc -l'
110
111# Shortcut for downloading youtube videos and music with yt-dlp
112# yt-dlp is required for these.
113alias ytvideo-download='yt-dlp -o "%(title)s.%(ext)s" -f bestvideo+bestaudio/best'
114alias ytmusic-download='yt-dlp -o "%(title)s.%(ext)s" -f bestaudio\[ext=m4a\]'
115
116# Add path
117export 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
121setopt HIST_IGNORE_SPACE
122
123# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
124[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh