From 5c74383ddaf15a01c8089fecf23e2c73d6f0515a Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 20 Sep 2023 09:48:28 +0300 Subject: [PATCH] chore(shell): add aliases and cleanup zsh plugins --- config/alias | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ config/functions | 4 ---- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/config/alias b/config/alias index 9e3c938..90cf24c 100755 --- a/config/alias +++ b/config/alias @@ -55,6 +55,55 @@ if [[ $(uname) == 'Darwin' ]]; then alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" fi +# Be nice +alias please="sudo " + +# Easier navigation: .., ..., .... +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." + +# Colors for ls +alias ll="ls -l" +alias l="ls" + +# Prevent common typos +alias cd..="cd .." +alias sl="ls" + +# List only directories +alias lsd="ls -lF | grep '^d'" + +# Recursively delete `.pyc` files +alias rmpyc="find . -type f -name '*.pyc' -ls -delete" + +# Recursively delete `.DS_Store` files +alias rmds="find . -type f -name '*.DS_Store' -ls -delete" + +# IP addresses +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en1" +alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'" + +# Show/hide hidden files in Finder +alias show="defaults write com.apple.finder AppleShowAllFiles -bool true; killall Finder" +alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false; killall Finder" + +# Pipe public key to clipboard. +alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'" + +# Flush Directory Service cache +alias flush="dscacheutil -flushcache" + +# Update locatedb +alias updatedb="sudo /usr/libexec/locate.updatedb" + +# Always return full history +alias history="history 1" + +alias pip="pip3 " +alias python="python3 " + # tmux: automatically attach or create session with name 'main' alias tmux='tmux new-session -A -s main' # tmux: attach or create new session diff --git a/config/functions b/config/functions index 64e6798..52a83cb 100755 --- a/config/functions +++ b/config/functions @@ -67,15 +67,11 @@ x-default-antigen-bundles() export ZSH_TMUX_AUTOQUIT=false export ZSH_TMUX_DEFAULT_SESSION_NAME=main - # Add keychain to ssh-agent args when on macOS - have brew && zstyle :omz:plugins:ssh-agent ssh-add-args --apple-load-keychain - # these should be always available antigen bundle tmux antigen bundle colored-man-pages antigen bundle command-not-found antigen bundle ssh-agent - # antigen bundle MichaelAquilina/zsh-you-should-use antigen bundle jreese/zsh-titles antigen bundle unixorn/autoupdate-antigen.zshplugin antigen bundle zsh-users/zsh-completions