From 57978f6f7bf8f9da58854e3723f977813e8d367c Mon Sep 17 00:00:00 2001 From: Andrei Stoica Date: Wed, 30 May 2018 13:10:42 -0400 Subject: [PATCH] added zsh config --- .oh-my-zsh/custom/themes/blokkzh.zsh-theme | 82 +++++++++++++++++++ .zshrc | 94 ++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 .oh-my-zsh/custom/themes/blokkzh.zsh-theme create mode 100644 .zshrc diff --git a/.oh-my-zsh/custom/themes/blokkzh.zsh-theme b/.oh-my-zsh/custom/themes/blokkzh.zsh-theme new file mode 100644 index 0000000..078c769 --- /dev/null +++ b/.oh-my-zsh/custom/themes/blokkzh.zsh-theme @@ -0,0 +1,82 @@ +# ZSH Theme - Preview: https://raw.githubusercontent.com/KorvinSilver/blokkzh/master/preview.png +# Mod of the gnzh theme + +setopt prompt_subst + +(){ + + local PR_USER PR_USER_OP PR_PROMPT PR_HOST PR_AT + local userName hostName atSign promptSign + local returnSymbol promptSymbolFrom promptSymbolTo promptSymbol rvmSymbol + +# Switch to ASCII characters in Linux term + if [[ ${TERM} == "linux" ]]; + then + returnSymbol='<<' + promptSymbolFrom='/-' + promptSymbolTo='\-' + promptSymbol='>' + rvmSymbol='%F{red}rvm%f' + ZSH_THEME_GIT_PROMPT_PREFIX='-[%F{yellow}git ' + ZSH_THEME_GIT_PROMPT_SUFFIX='%f]' + ZSH_THEME_VIRTUALENV_PREFIX='-[%F{green}python ' + ZSH_THEME_VIRTUALENV_SUFFIX='%f]' + else + returnSymbol='↵' + promptSymbolFrom='┌─' + promptSymbolTo='└─' + promptSymbol='➤' + rvmSymbol='%F{red}🔻%f' + ZSH_THEME_GIT_PROMPT_PREFIX='─[%F{yellow} ' + ZSH_THEME_GIT_PROMPT_SUFFIX='%f]' + ZSH_THEME_VIRTUALENV_PREFIX='─[%F{green}🐍 ' + ZSH_THEME_VIRTUALENV_SUFFIX='%f]' + fi + +# Check the UID + if [[ $UID -ne 0 ]]; then # normal user + PR_USER='%F{yellow}%n%f' + PR_USER_OP='%F{yellow}%#%f' + PR_PROMPT="${promptSymbol}" + PR_AT='@' + else # root + PR_USER='' + PR_USER_OP='' + PR_PROMPT="%F{red}${promptSymbol}%f" + PR_AT='' + fi + +# Check if we are on SSH or not + if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then + if [[ $UID -eq 0 ]]; then + PR_HOST='%B%F{magenta}%M%f%b' # SSH, root + else + PR_HOST='%F{green}%M%f' # SSH, normal user + fi + elif [[ $UID -eq 0 ]]; then + PR_HOST='%B%F{red}%M%f%b' # no SSH, root + else + PR_HOST='%F{cyan}%M%f' # no SSH, normal user + fi + + local return_code="%(?..%F{red}%? ${returnSymbol}%f)" + + local user_host="${PR_USER}${PR_AT}${PR_HOST}" + local current_dir="%B%F{blue}%~%f%b" + local rvm_ruby='' + if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation + rvm_ruby='─['${rvmSymbol}' %F{red}$(${HOME}/.rvm/bin/rvm-prompt i v g s)%f]' + elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation + rvm_ruby='─['${rvmSymbol}' %F{red}$(rvm-prompt i v g s)%f]' + elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management + rvm_ruby='─['${rvmSymbol}' %F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]' + fi + + local git_branch='$(git_prompt_info)' + local venv_python='$(virtualenv_prompt_info)' + + PROMPT="${promptSymbolFrom}[${user_host}]${rvm_ruby}${venv_python}─[${current_dir}]${git_branch} +${promptSymbolTo}$PR_PROMPT " + + RPROMPT="${return_code}" +} diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..4afebcb --- /dev/null +++ b/.zshrc @@ -0,0 +1,94 @@ +# 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=/home/andrei/.oh-my-zsh + +# Set name of the theme to load. Optionally, if you set this to "random" +# it'll load a random theme each time that oh-my-zsh is loaded. +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="blokkzh" + +# Set list of themes to load +# Setting this variable when ZSH_THEME="blokkzh" +# cause zsh load theme from this variable instead of +# looking in ~/.oh-my-zsh/themes/ +# An empty array have no effect +# ZSH_THEME="blokkzh" + +# 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 change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# 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. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# 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? (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) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git +) + +source $ZSH/oh-my-zsh.sh + +# 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" + +# ssh +# export SSH_KEY_PATH="~/.ssh/rsa_id" + +# 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"