diff --git a/configs/zsh/.zshrc b/configs/zsh/.zshrc new file mode 100644 index 0000000..1298565 --- /dev/null +++ b/configs/zsh/.zshrc @@ -0,0 +1,17 @@ + +# There are some important env vars that need to exist +export ZSH="$HOME/.oh-my-zsh" +export EWCONFIG_ROOT="$HOME/.config/ewconfig" + +# Load zsh-specific stuff +plugins=(zsh-autosuggestions) +source $ZSH/oh-my-zsh.sh + +# Load my custom prompt and macros +. $EWCONFIG_ROOT/configs/zsh/prompt.sh +. $EWCONFIG_ROOT/configs/zsh/macros.sh + +# Load per-host configuration +if [ -f $EWCONFIG_ROOT/configs/zsh/by_host/$HOSTNAME.sh ]; then + . $EWCONFIG_ROOT/configs/zsh/by_host/$HOSTNAME.sh +fi \ No newline at end of file diff --git a/configs/zsh/by_host/ewpratten-desktop.sh b/configs/zsh/by_host/ewpratten-desktop.sh new file mode 100644 index 0000000..efcbaec --- /dev/null +++ b/configs/zsh/by_host/ewpratten-desktop.sh @@ -0,0 +1 @@ +#! /bin/bash \ No newline at end of file diff --git a/configs/zsh/by_host/ewpratten-laptop.sh b/configs/zsh/by_host/ewpratten-laptop.sh new file mode 100644 index 0000000..efcbaec --- /dev/null +++ b/configs/zsh/by_host/ewpratten-laptop.sh @@ -0,0 +1 @@ +#! /bin/bash \ No newline at end of file diff --git a/configs/zsh/macros.sh b/configs/zsh/macros.sh new file mode 100644 index 0000000..dae2241 --- /dev/null +++ b/configs/zsh/macros.sh @@ -0,0 +1,40 @@ +alias ls="ls --color=auto" +alias ll="ls -l" +alias la="ls -a" +alias :q="exit" +alias :wq="exit" +alias cls=clear +alias p4='ping 8.8.8.8 -c 4' +alias quickhttp='sudo python -m SimpleHTTPServer 443' +alias zshreload="source ~/.zshrc" + +# Makes a directory, then moves into it +mkcd() { + if [ $# != 1 ]; then + echo "Usage: mkcd " + else + mkdir -p $1 && cd $1 + fi +} + +# Auto-extract anything +extract() { + if [ -f $1 ]; then + case $1 in + *.tar.bz2) tar xvjf $1 ;; + *.tar.gz) tar xvzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xvf $1 ;; + *.tbz2) tar xvjf $1 ;; + *.tgz) tar xvzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "don't know how to extract '$1'..." ;; + esac + else + echo "'$1' is not a valid file!" + fi +} \ No newline at end of file diff --git a/configs/zsh/prompt.sh b/configs/zsh/prompt.sh new file mode 100644 index 0000000..9ef1dee --- /dev/null +++ b/configs/zsh/prompt.sh @@ -0,0 +1,24 @@ +# This is some kind of dark magic. +# I have no memory of whats going on here, but this has been my config since 2015-ish, so it shall not be touched. + +autoload -U colors && colors +NEWLINE=$'\n' +export PROMPT="%{$fg[green]%}%n@%M %{$fg[cyan]%}%~ $ %{$reset_color%}" +setopt prompt_subst +autoload -Uz vcs_info +zstyle ':vcs_info:*' actionformats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' + +zstyle ':vcs_info:*' enable git cvs svn + +# or use pre_cmd, see man zshcontrib +vcs_info_wrapper() { + vcs_info + if [ -n "$vcs_info_msg_0_" ]; then + echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del" + fi +} +export RPROMPT=$'%@ $(vcs_info_wrapper) %?' diff --git a/install.conf.yaml b/install.conf.yaml index 3ecea76..8d56d42 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -6,9 +6,6 @@ - link: ~/.gitconfig: configs/git/.gitconfig - ~/.ssh/config: - path: configs/ssh/config - force: true - create: - ~/Downloads