Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding zsh support #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions dotfiles_zsh/.aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Shortcuts
alias ch='history | grep "git commit"'
alias hg='history | grep'

# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi

# List all files colorized in long format, including dot files
alias la="ls -lahF ${colorflag}"

# Always use color output for `ls`
alias ls="command ls ${colorflag}"
export LS_COLORS='no=00:fi=00:di=04;35:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'

export LSCOLORS='Gxfxcxdxbxegedabagacad'


# Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# Enable aliases to be sudo’ed
alias sudo='sudo '

# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update_system='sudo softwareupdate -i -a'

# 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"

# To prep before screencasts
alias tut_mode='defaults write com.apple.dock autohide -bool true && killall Dock;
defaults write com.apple.finder CreateDesktop -bool false && killall Finder;
defaults write com.apple.menuextra.clock IsAnalog -bool true && killall SystemUIServer;
rm -rf ~/.Trash/*;
rm -rf ~/Downloads/*'
alias reg_mode='defaults write com.apple.dock autohide -bool false && killall Dock;
defaults write com.apple.finder CreateDesktop -bool true && killall Finder;
defaults write com.apple.menuextra.clock IsAnalog -bool false && killall SystemUIServer;'

alias clean='rm -rf ~/.Trash/*; rm -rf ~/Downloads/*'
alias wipe_env='rm -rf ~/tutorial_env; python3 -m venv ~/tutorial_env'
alias tut_env='source ~/tutorial_env/bin/activate'
13 changes: 13 additions & 0 deletions dotfiles_zsh/.zprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
eval "$(/usr/local/bin/brew shellenv)"


# Load dotfiles:
for file in ~/.{zsh_prompt,aliases,private}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;


# Setting PATH for Python 3.7
# PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
# export PATH
125 changes: 125 additions & 0 deletions dotfiles_zsh/.zsh_prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# https://dev.to/cassidoo/customizing-my-zsh-prompt-3417
autoload -Uz vcs_info
precmd() { vcs_info }

zstyle ':vcs_info:git:*' formats '%b '

setopt PROMPT_SUBST
PROMPT='%F{green}%*%f %F{blue}%C%f %F{red}${vcs_info_msg_0_}%f$ '



# # Shell prompt based on the Solarized Dark theme.
# # Screenshot: http://i.imgur.com/EkEtphC.png
# # Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# # iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.

# if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
# export TERM='gnome-256color';
# elif infocmp xterm-256color >/dev/null 2>&1; then
# export TERM='xterm-256color';
# fi;

# prompt_git() {
# local s='';
# local branchName='';

# # Check if the current directory is in a Git repository.
# if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then

# # check if the current directory is in .git before running git checks
# if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then

# # Ensure the index is up to date.
# git update-index --really-refresh -q &>/dev/null;

# # Check for uncommitted changes in the index.
# if ! $(git diff --quiet --ignore-submodules --cached); then
# s+='+';
# fi;

# # Check for unstaged changes.
# if ! $(git diff-files --quiet --ignore-submodules --); then
# s+='!';
# fi;

# # Check for untracked files.
# if [ -n "$(git ls-files --others --exclude-standard)" ]; then
# s+='?';
# fi;

# # Check for stashed files.
# if $(git rev-parse --verify refs/stash &>/dev/null); then
# s+='$';
# fi;

# fi;

# # Get the short symbolic ref.
# # If HEAD isn’t a symbolic ref, get the short SHA for the latest commit
# # Otherwise, just give up.
# branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
# git rev-parse --short HEAD 2> /dev/null || \
# echo '(unknown)')";

# [ -n "${s}" ] && s=" [${s}]";

# echo -e "${1}${branchName}${2}${s}";
# else
# return;
# fi;
# }

# if tput setaf 1 &> /dev/null; then
# tput sgr0; # reset colors
# bold=$(tput bold);
# reset=$(tput sgr0);
# # Solarized colors, taken from http://git.io/solarized-colors.
# black=$(tput setaf 0);
# blue=$(tput setaf 153);
# green=$(tput setaf 71);
# orange=$(tput setaf 166);
# red=$(tput setaf 167);
# white=$(tput setaf 15);
# yellow=$(tput setaf 228);
# else
# bold='';
# reset="\e[0m";
# black="\e[1;30m";
# blue="\e[1;34m";
# green="\e[1;32m";
# orange="\e[1;33m";
# red="\e[1;31m";
# white="\e[1;37m";
# yellow="\e[1;33m";
# fi;

# # Highlight the user name when logged in as root.
# if [[ "${USER}" == "root" ]]; then
# userStyle="${red}";
# else
# userStyle="${orange}";
# fi;

# # Highlight the hostname when connected via SSH.
# if [[ "${SSH_TTY}" ]]; then
# hostStyle="${bold}${red}";
# else
# hostStyle="${yellow}";
# fi;

# # Set the terminal title to the current working directory.
# PS1="\[\033]0;\w\007\]";
# PS1+="\[${bold}\]\n"; # newline
# PS1+="\[${userStyle}\]\u"; # username
# PS1+="\[${white}\] at ";
# PS1+="\[${hostStyle}\]\h"; # host
# PS1+="\[${white}\] in ";
# PS1+="\[${green}\]\W"; # working directory
# PS1+="\$(prompt_git \"\[${white}\] on \[${blue}\]\" \"\[${blue}\]\")"; # Git repository details
# PS1+="\n";
# PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
# export PS1;

# PS2="\[${yellow}\]→ \[${reset}\]";
# export PS2;
5 changes: 5 additions & 0 deletions dotfiles_zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# If not running interactively, don't do anything
[[ $- == *i* ]] || return

# -n Checks if the length of a string is nonzero.
[ -n "$PS1" ] && source ~/.zprofile;
14 changes: 14 additions & 0 deletions dotfiles_zsh/brew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env zsh

# Install Brew Packages
brew install [email protected]
brew install tree

# Install MacOS Applications
brew install --cask virtualbox
brew install --cask visual-studio-code

# Install Source Code Pro Font
brew tap homebrew/cask-fonts
brew install --cask font-source-code-pro

38 changes: 38 additions & 0 deletions dotfiles_zsh/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env zsh
############################
# This script creates symlinks from the home directory to any desired dotfiles in ${homedir}/dotfiles
# And also installs Homebrew Packages
# And sets Sublime preferences
############################

if [ "$#" -ne 1 ]; then
echo "Usage: install.sh <home_directory>"
exit 1
fi

homedir=$1

# dotfiles directory
dotfiledir=${homedir}/dotfiles_zsh

# list of files/folders to symlink in ${homedir}
files="zprofile zshrc zsh_prompt aliases private"

# change to the dotfiles directory
echo "Changing to the ${dotfiledir} directory"
cd ${dotfiledir}
echo "...done"

# create symlinks (will overwrite old dotfiles)
for file in ${=~files}; do
echo "Creating symlink to $file in home directory."
ln -sf ${dotfiledir}/.${file} ${homedir}/.${file}
echo "created the .${file} symlink"
done

# Download Git Auto-Completion
# curl "https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" > ${homedir}/.git-completion.bash

# Run the Homebrew Script
./brew.sh