From 25f53a9c068016593708fda5f0da97f0d8a745e9 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 19 Nov 2016 22:04:40 +0000 Subject: [PATCH] Setup zsh --- Makefile | 1 + bash/.bashrc | 66 ++++++++++++++++++++++++++---------------- bash/.zshrc | 21 ++++++++++++++ bash/base.sh | 48 ++++++++++++++++++++++++++++++ bash/boilerplate.sh | 66 ------------------------------------------ config/terminator.conf | 2 +- yaourt/packages.conf | 3 ++ 7 files changed, 115 insertions(+), 92 deletions(-) create mode 100644 bash/.zshrc create mode 100644 bash/base.sh delete mode 100644 bash/boilerplate.sh diff --git a/Makefile b/Makefile index 8e3b715..0ecbc40 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ bin: bash: yaourt ln -sfP $(DOTFILES)/bash/.bashrc ~/.bashrc + ln -sfP $(DOTFILES)/bash/.zshrc ~/.zshrc mkdir -p ~/.nvm/ ln -sfP /usr/share/nvm/init-nvm.sh ~/.nvm/nvm.sh diff --git a/bash/.bashrc b/bash/.bashrc index 0884117..7fd5863 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -1,31 +1,47 @@ -export DOTFILES="$HOME/.dotfiles" +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac -source $DOTFILES/bash/boilerplate.sh -source $DOTFILES/bash/catfish.sh -source $DOTFILES/bash/javascript.sh -source $DOTFILES/bash/applications.sh +# don't put duplicate lines or lines starting with space in the history. +HISTCONTROL=ignoreboth +# append to the history file, don't overwrite it +shopt -s histappend -if [ -f "$(command -v lsb_release)" ]; then - source $DOTFILES/bash/ubuntu.sh # Ubuntu only stuff -elif [ -f "$(command -v pacman)" ]; then - source $DOTFILES/bash/arch.sh # Arch only stuff +# check the window size after each command and, if necessary, update the values of LINES and COLUMNS. +shopt -s checkwinsize + +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (debian-based only) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) fi -# Export some variables -export ANDROID_HOME=/opt/android-sdk -export EDITOR=/bin/nano +# Set prompt +PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -# Extend path -export PATH=${PATH}:${ANDROID_HOME}/tools -export PATH=${PATH}:${ANDROID_HOME}/platform-tools -export PATH=${PATH}:/opt/genymobile/genymotion -export PATH=${HOME}/.dotfiles/bin:${PATH} +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac -# bash aliases -alias src="source ~/.bashrc" -alias refresh="cd $PWD > /dev/null" -alias c="clear" -alias cls="clear" -alias e="exit" -alias please="sudo" -alias no="yes n" +# enable programmable completion features (you don't need to enable this, if it's already enabled in /etc/bash.bashrc and /etc/profile sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + + +alias src="source $HOME/.bashrc" + +export DOTFILES="$HOME/.dotfiles" +source $DOTFILES/bash/base.sh diff --git a/bash/.zshrc b/bash/.zshrc new file mode 100644 index 0000000..6a1a70c --- /dev/null +++ b/bash/.zshrc @@ -0,0 +1,21 @@ +# Path to your oh-my-zsh installation. +export ZSH=/usr/share/oh-my-zsh/ +source $ZSH/oh-my-zsh.sh + +# Plugins +plugins=(git-extras catimg django npm pip pyenv python) + +# You may need to manually set your language environment +export LANG=en_GB.UTF-8 + +# Compilation flags +export ARCHFLAGS="-arch x86_64" + +autoload -Uz colors && colors +local ret_status="%(?:%{$fg_bold[green]%}λ :%{$fg_bold[red]%}λ )" +export PROMPT="${ret_status} %{$fg_bold[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%~%{$reset_color%}$ " + +alias src="source $HOME/.zshrc" + +export DOTFILES="$HOME/.dotfiles" +source $DOTFILES/bash/base.sh diff --git a/bash/base.sh b/bash/base.sh new file mode 100644 index 0000000..7a06900 --- /dev/null +++ b/bash/base.sh @@ -0,0 +1,48 @@ +source $DOTFILES/bash/catfish.sh +source $DOTFILES/bash/javascript.sh +source $DOTFILES/bash/applications.sh + +if [ -f "$(command -v lsb_release)" ]; then + source $DOTFILES/bash/ubuntu.sh # Ubuntu only stuff +elif [ -f "$(command -v pacman)" ]; then + source $DOTFILES/bash/arch.sh # Arch only stuff +fi + +# Export some variables +export ANDROID_HOME=/opt/android-sdk +export EDITOR=/bin/nano + +# Extend path +export PATH=${PATH}:${ANDROID_HOME}/tools +export PATH=${PATH}:${ANDROID_HOME}/platform-tools +export PATH=${PATH}:/opt/genymobile/genymotion +export PATH=${HOME}/.dotfiles/bin:${PATH} + +# bash aliases +alias refresh="cd $PWD > /dev/null" +alias c="clear" +alias cls="clear" +alias e="exit" +alias please="sudo" +alias no="yes n" + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + + +# colored GCC warnings and errors +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# colour! +alias ls='ls --color=auto' +alias dir='dir --color=auto' +alias vdir='vdir --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" diff --git a/bash/boilerplate.sh b/bash/boilerplate.sh deleted file mode 100644 index aaa72cb..0000000 --- a/bash/boilerplate.sh +++ /dev/null @@ -1,66 +0,0 @@ -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -HISTCONTROL=ignoreboth -# append to the history file, don't overwrite it -shopt -s histappend -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, update the values of LINES and COLUMNS. -shopt -s checkwinsize - -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (debian-based only) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# Set prompt -PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - alias dir='dir --color=auto' - alias vdir='vdir --color=auto' - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' - -# Add an "alert" alias for long running commands -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - -# enable programmable completion features (you don't need to enable this, if it's already enabled in /etc/bash.bashrc and /etc/profile sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi diff --git a/config/terminator.conf b/config/terminator.conf index e18c3c0..033ac2a 100644 --- a/config/terminator.conf +++ b/config/terminator.conf @@ -66,7 +66,7 @@ audible_bell = True background_darkness = 0.8 background_image = None - font = Monospace 11 + font = Source Code Pro 11 foreground_color = "#bfbfbf" palette = "#000000:#cd0000:#00cd00:#cdcd00:#0000ee:#cd00cd:#00cdcd:#e5e5e5:#7f7f7f:#ff0000:#00ff00:#ffff00:#5c5cff:#ff00ff:#00ffff:#ffffff" scrollback_infinite = True diff --git a/yaourt/packages.conf b/yaourt/packages.conf index 4b63d6a..bc0b3a6 100644 --- a/yaourt/packages.conf +++ b/yaourt/packages.conf @@ -53,6 +53,7 @@ nodejs numix-themes nvm obs-studio +oh-my-zsh-git postgresql postman-bin psensor @@ -94,3 +95,5 @@ yaourt yubikey-neo-manager yubikey-personalization-gui zeal +zsh +zsh-doc