Skip to content

Instantly share code, notes, and snippets.

@oblique63
Last active May 28, 2021 01:06
Show Gist options
  • Save oblique63/5664352 to your computer and use it in GitHub Desktop.
Save oblique63/5664352 to your computer and use it in GitHub Desktop.
zsh configuration
# Assumes oh-my-zsh, xclip, and aptitude are installed
# Ubuntu/Debian
alias install="sudo aptitude -ZWry install"
alias uninstall="sudo aptitude -ZWry remove"
alias full-uninstall="sudo aptitude -ZWry purge"
alias installed="dpkg --get-selections | grep"
alias add-repo="sudo add-apt-repository"
alias repo-update="sudo aptitude update"
alias update="sudo aptitude -ZWry safe-upgrade && sudo aptitude -ZWry --purge-unused clean"
alias pkg-search="aptitude search"
alias pkg-info="aptitude show"
alias pkg-clean="sudo aptitude clean"
# Utility
alias rm="rm -i"
alias mkex="chmod +x"
alias untar="tar xvzf"
alias again="!!"
alias clr="clear"
alias bless="less -FXeq" # 'better' less
alias copy-from="xclip -sel clip <"
alias ssh-key="cat ~/.ssh/id_rsa.pub"
alias copy-ssh-key="copy-from ~/.ssh/id_rsa.pub"
# Info
alias space="df -h"
alias memory="free -m"
alias mem="memory"
alias app="apropos"
alias which-app="app"
alias where="which"
alias pss="ps auxfck -pcpu,size | bless"
# Paths
alias user-paths="more ~/.paths"
addpath() {
echo "$1" >> ~/.paths
export PATH="$PATH:$1"
}
loadPaths() {
if [ -f ~/.paths -a ! $PATHS_LOADED ]; then
for line in `cat ~/.paths` ; do
PATH="$PATH:$line"
done
export PATH
export PATHS_LOADED=true
fi
}
loadPaths
# ls
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -la'
alias lss="ls -ABgoh"
# Navigation
cdpath=(. ~ ~/Code)
alias up="cd .."
alias up2="cd ../.."
alias up3="cd ../../.."
alias up4="cd ../../../.."
alias desk="cd ~/Desktop"
alias back="cd -"
backto() {
current_path=`pwd`
match_length=`expr $current_path : .*$1`
if [ $match_length -eq 0 ]; then
echo "No such directory in your current path:" $1
else
destination=${current_path:0:match_length}
if [ $2 ]; then
destination=$destination"/"$2
fi
echo $destination
cd $destination
fi
}
# Nonsense
alias fuck="killall"
alias bitch="sudo"
alias moar="more"
alias wtf="pss"
# Meta
alias update-profile="source ~/.zprofile"
alias edit-profile="nano ~/.zprofile && update-profile"
alias profile="less ~/.zprofile"
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="oblique" #"pygmalion" #"miloshadzic" #"robbyrussell"
# Example aliases
alias zshconfig="nano ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git mercurial extract colored-man gradle themes)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=$PATH:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
source ~/.zprofile
# Based off 'miloshadzic' theme
shortPath() {
DIR=`pwd|sed -e "s!$HOME!~!"`
if [ ${#DIR} -gt 34 ]; then
CurDir=${DIR:0:14}...${DIR:${#DIR}-17};
else
CurDir=$DIR
fi
echo $CurDir
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{$fg[cyan]%}$(shortPath)%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
RPROMPT='%{$fg[magenta]%}%*%{$reset_color%}'
@CeruttiMaicon
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment