Skip to content

Instantly share code, notes, and snippets.

@shakedlokits
Last active August 25, 2023 12:33
Show Gist options
  • Save shakedlokits/c0311a90b4997a28f555a8a850981312 to your computer and use it in GitHub Desktop.
Save shakedlokits/c0311a90b4997a28f555a8a850981312 to your computer and use it in GitHub Desktop.
##############################################
# DEPENDENCIES #
##############################################
export PYTHON_VERSION=3.10.12
export NODE_VERSION=18.17
# Install XCode developer tools
if test -z $(xcode-select -p)
then
xcode-select --install
echo "✅ XCode developer tools installed"
fi
# Install Antigen package manager
if ! test "~/antigen.zsh"
then
curl -L git.io/antigen > ~/antigen.zsh
echo "✅ Antigen installed"
fi
# Install Vim runtime
if ! test "~/.vim_runtime"
then
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
echo "✅ Vim runtime installed"
fi
# Install Homebrew
if ! command -v brew &> /dev/null
then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "✅ Homebrew installed"
fi
# Install Github CLI
if ! command -v gh &> /dev/null
then
brew install gh
echo "✅ Github CLI installed"
fi
# Install Rust
if ! command -v rustc &> /dev/null
then
brew install rustup
rustup-init
echo "✅ Rust installed"
fi
# Install NVM
if ! test "~/.nvm"
then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
nvm install "$NODE_VERSION"
echo "✅ NVM installed"
fi
# Install Pyenv
if ! command -v pyenv &> /dev/null
then
brew install pyenv
pyenv install "$PYTHON_VERSION"
brew install pyenv-virtualenv
echo "✅ Pyenv installed"
fi
# Install Bat
if ! command -v bat &> /dev/null
then
brew install bat
echo "✅ Bat installed"
fi
# Install Exa
if ! command -v exa &> /dev/null
then
brew install exa
echo "✅ Exa installed"
fi
# Install enhancd requirements
if ! command -v fzy &> /dev/null
then
brew tap jhawthorn/fzy
brew install fzy ccat
echo "✅ Enhancd requirements installed"
fi
##############################################
# KEY BINDINGS #
##############################################
bindkey -e
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey '^i' expand-or-complete-prefix
##############################################
# ZSH CONFIGURATION #
##############################################
source ~/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle heroku
antigen bundle pip
antigen bundle lein
# antigen bundle command-not-found
antigen bundle rake
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
# Load the theme.
antigen theme denysdovhan/spaceship-prompt
# Load enhanced cd
antigen bundle b4b4r07/enhancd
# I should use..
antigen bundle "MichaelAquilina/zsh-you-should-use"
# Tell Antigen that you're done.
antigen apply
##############################################
# SPACESHIP CONFIGURATION #
##############################################
export SPACESHIP_PROMPT_ORDER=(
time # Time stamps section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
dotnet # .NET section
terraform # Terraform workspace section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
export SPACESHIP_CHAR_SYMBOL="\uf0e7"
export SPACESHIP_CHAR_SUFFIX=(" ")
export SPACESHIP_CHAR_COLOR_SUCCESS="yellow"
export SPACESHIP_USER_SHOW="true"
##############################################
# HISTORY CONFIGURATION #
##############################################
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
##############################################
# ENVIRONMENT CONFIGURATION #
##############################################
# Set locales
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Add Rust
export PATH=$PATH:$HOME/.cargo/bin
# Add nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Configure PyEnv
export PATH="/home/slokits/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv shell "${PYTHON_VERSION}"
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
#source "/home/slokits/.pyenv/versions/${PYTHON_VERSION}/bin/virtualenvwrapper.sh"
##############################################
# APP CONFIGURATION #
##############################################
# Added exa ls
alias ls="exa -alhUGg --git"
# Add BAT color log
alias cat=bat
# Docker utilities
docker-clear-images(){ docker images -aq | xargs -I {} docker rmi --force {}; }
docker-clear-containers() { docker ps -aq | xargs -I {} docker stop {} | xargs -I {} docker rm {}; }
# Git utilities
ls-pr(){git --no-pager diff --name-only $(git branch | grep \* | cut -d ' ' -f2) $(git merge-base $(git branch | grep \* | cut -d ' ' -f2) master);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment