Skip to content

Instantly share code, notes, and snippets.

@Terance98

Terance98/zsh_config.txt

Last active Oct 17, 2020
Embed
What would you like to do?
# 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="/Users/terance98/.oh-my-zsh"
plugins=(
git
bundler
dotenv
osx
rake
last-working-dir
web-search
extract
history
sudo
z
)
## checkout a new remote branch (exists remote, not locally)
## git checkout -b LocalName origin/remotebranchname (checkout a remote branch)
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the 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"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
source $ZSH/oh-my-zsh.sh
source /Users/terance98/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# 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
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# 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`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
# Setting up aliases
## git aliases
alias gc="git commit -m "$@"";
alias gcd="git checkout develop";
alias gmd="git merge develop";
alias gctd="git checkout terance-develop";
alias gcnad="git checkout newAdminDashboard";
alias gs="git status"
alias gpull="git pull";
alias gcls="git clean -nd" #show files to be cleaned
alias gclr="git clean -fd" #remove files to be cleaned
alias gpush="git push origin HEAD";
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
alias gref="git reflog";
alias gbc="git checkout -B "
alias gbd="git branch -D "
alias ga="git add -A";
alias gb="git branch";
alias grh="git reset --hard";
alias grm="git reset --mixed";
alias gch="git checkout "
alias gcm="git checkout master";
alias gf="git fetch";
alias gfa="git fetch --all";
alias gf="git fetch origin";
alias gd="git diff";
alias gbr="git branch remote"
alias gfr="git remote update"
# alias grh="git reset HEAD~" # last commit
alias gac="git add -A && git commit -a -m "
alias gsu="git gpush --set-upstream origin "
## npm aliases
alias ni="npm install";
alias ninit="npm init -y"
alias nig="npm i -g";
alias nrs="npm run start -s --";
alias nrb="npm run build -s --";
alias nrd="npm run dev -s --";
alias nrt="npm run test -s --";
alias nrtw="npm run test:watch -s --";
alias nrv="npm run validate -s --";
alias nrm="rm -rf node_modules";
alias flush-npm="rm -rf node_modules && npm i && echo NPM is done";
function lf() {
ls -lhgnF "$@"| grep -v ^total | awk '{print "\033[0m"$2"\033[0m","\t" "\033[0;32m"$4"\033[0m","\t" "\033[1;31m"$5"\033[0m", "\033[01;31m"$6"\033[01;31m"," " "\033[01;34m"$7"\033[01;34m","\t" "\033[1;93m" $8 "\033[1;39m"}'
}
## other aliases
alias zshrc='vim ~/.zshrc'
alias topten="history | commands | sort -rn | head"
alias myip="curl http://ipecho.net/plain; echo"
alias dirs='dirs -v | head -10'
alias usage='du -h -d1'
alias update="source ~/.zshrc"
alias sshdir="cd ~/.ssh"
alias runp="lsof -i"
alias md="mkdir "
alias ..='cd ..'
alias ...='cd ../..'
alias ls="lf"
## this loads NVM
# [[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
## custom functions
gpr() {
if [ $? -eq 0 ]; then
github_url=`git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@' -e 's%\.git$%%'`;
branch_name=`git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3`;
pr_url=$github_url"/compare/develop..."$branch_name
open $pr_url;
else
echo 'failed to open a pull request.';
fi
}
gacp() {
git add -A && git commit -m "$@" && git push origin HEAD;
}
# List content when changing directory
# function cd() {
# builtin cd "$@"; ls -lh;
# }
# commands() {
# awk '{a[$2]++}END{for(i in a){print a[i] " " i}}'
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.