]> arthur.barton.de Git - ax-zsh.git/commitdiff
Initial commit
authorAlexander Barton <alex@barton.de>
Fri, 3 Jul 2015 00:20:35 +0000 (02:20 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 3 Jul 2015 00:20:35 +0000 (02:20 +0200)
25 files changed:
AUTHORS [new file with mode: 0644]
LICENSE.md [new file with mode: 0644]
README.md [new file with mode: 0644]
ax.zsh [new file with mode: 0644]
core/10_terminal/10_terminal.zprofile [new file with mode: 0644]
core/10_terminal/10_terminal.zshrc [new file with mode: 0644]
core/20_home/20_home.zprofile [new file with mode: 0644]
core/30_hostname/30_hostname.zprofile [new file with mode: 0644]
core/50_prompt/50_prompt.zshrc [new file with mode: 0644]
core/80_local_config/80_local_config.zlogin [new file with mode: 0644]
core/80_local_config/80_local_config.zlogout [new file with mode: 0644]
core/80_local_config/80_local_config.zprofile [new file with mode: 0644]
core/80_local_config/80_local_config.zshrc [new file with mode: 0644]
core/90_completion_init/90_completion_init.zshrc [new file with mode: 0644]
install.sh [new file with mode: 0755]
plugins/byebye/byebye.zlogout [new file with mode: 0644]
plugins/completion/completion.zshrc [new file with mode: 0644]
plugins/correction/correction.zshrc [new file with mode: 0644]
plugins/git/git.zshrc [new file with mode: 0644]
plugins/history/history.zshrc [new file with mode: 0644]
plugins/homebrew/homebrew.zshrc [new file with mode: 0644]
plugins/ls/ls.zshrc [new file with mode: 0644]
plugins/prompt/prompt.zlogin [new file with mode: 0644]
plugins/ssh/ssh.zshrc [new file with mode: 0644]
plugins/std_aliases/std_aliases.zshrc [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..9ebacba
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Alexander Barton <alex@barton.de>
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644 (file)
index 0000000..542a267
--- /dev/null
@@ -0,0 +1,21 @@
+The MIT License
+
+- Copyright (c) 2015 Alexander Barton <alex@barton.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..940fc19
--- /dev/null
+++ b/README.md
@@ -0,0 +1,32 @@
+AX-ZSH: Alex' Modular ZSH Configuration
+=======================================
+
+
+Environment Variables
+---------------------
+
+Expected to be already set:
+
+* `HOME`
+* `LOGNAME`
+
+Validated and/or set up:
+
+* `AXZSH`
+* `HOST`
+* `HOSTNAME` (same as HOST, deprecated)
+* `LOCAL_HOME`
+* `PS1`
+* `SHORT_HOST`
+* `TERM`
+* `XDG_CACHE_HOME`
+* `ZSH_CACHE_DIR`
+
+
+Configuration Variables
+-----------------------
+
+The following configuration variables can be set in the `$HOME/.zshenv` file
+to configure "AX-ZSH":
+
+* `AXZSH_PLUGIN_D`
diff --git a/ax.zsh b/ax.zsh
new file mode 100644 (file)
index 0000000..63c2b83
--- /dev/null
+++ b/ax.zsh
@@ -0,0 +1,86 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# Copyright (c) 2015 Alexander Barton <alex@barton.de>
+
+# Load plugin code of a given type.
+# - $1: plugin name
+# - $2: plugin type (optional; defaults to "zshrc")
+function axzsh_load_plugin {
+       plugin="$1"
+       [[ -z "$2" ]] && type="zshrc" || type="$2"
+
+       for dname in \
+               "$AXZSH_PLUGIN_D/$plugin" \
+               "$AXZSH/plugins/$plugin" \
+               "$AXZSH/core/$plugin" \
+       ; do
+               [[ ! -d "$dname" ]] && continue
+
+               fname="$dname/$plugin.$type"
+               if [[ ! -r "$fname" && "$type" == "zshrc" ]]; then
+                       if [[ -r "$dname/$plugin.plugin.zsh" ]]; then
+                               # Oh My ZSH plugin
+                               type="plugin.zsh"
+                               fname="$dname/$plugin.plugin.zsh"
+                       elif [[ -r "$dname/init.zsh" ]]; then
+                               # Prezto module
+                               type="init.zsh"
+                               fname="$dname/init.zsh"
+                       fi
+               fi
+
+               if [[ -r "$fname" ]]; then
+                       [[ -f "$HOME/.axzsh.debug" ]] \
+                               && echo "   - $plugin ($type) ..."
+                       source "$fname"
+                       return 0
+               fi
+               return 0
+       done
+       [[ -f "$HOME/.axzsh.debug" ]] \
+               && echo "Plugin \"$plugin\" not found (type \"$type\")!" >/dev/stderr
+       return 1
+}
+
+# Make sure that "AXZSH" variable is set and exported
+if [[ -z "$AXZSH" ]]; then
+       export AXZSH="$HOME/.axzsh"
+       [[ -f "$HOME/.axzsh.debug" ]] && echo "AXZSH=$AXZSH"
+fi
+
+# Setup list of default plugins if not set already. This allows users to
+# overwrite this list in their "~/.zshrnv" file, for example.
+typeset -U axzsh_default_plugins
+if ! typeset +m axzsh_default_plugins | fgrep array >/dev/null 2>&1; then
+       axzsh_default_plugins=(
+               byebye
+               completion
+               correction
+               git
+               history
+               homebrew
+               ls
+               prompt
+               ssh
+               std_aliases
+       )
+fi
+
+# Setup list of plugins to load:
+typeset -U plugin_list
+plugin_list=(
+       $AXZSH/core/[0-5]*
+       $axzsh_default_plugins
+       $axzsh_plugins
+       $plugins
+       $AXZSH/core/[6-9]*
+)
+
+# Read in all the plugins for the current "type":
+script_name="$(basename -- "${(%):-%N}")"
+script_type="$script_name[2,-1]"
+[[ -f "$HOME/.axzsh.debug" ]] && echo "» $script_name:"
+for plugin ($plugin_list); do
+       axzsh_load_plugin "$(basename "$plugin")" "$script_type"
+done
+unset script_name script_type plugin
+unset plugin_list
diff --git a/core/10_terminal/10_terminal.zprofile b/core/10_terminal/10_terminal.zprofile
new file mode 100644 (file)
index 0000000..e70d6cd
--- /dev/null
@@ -0,0 +1,6 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 10_terminal.zprofile: Initialize terminal settings
+
+[[ -t 0 ]] && eval `tset -s`
+[[ -z "$TERM" ]] && TERM="dumb"
+export TERM
diff --git a/core/10_terminal/10_terminal.zshrc b/core/10_terminal/10_terminal.zshrc
new file mode 100644 (file)
index 0000000..5ac08f7
--- /dev/null
@@ -0,0 +1,43 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 10_terminal.zshrc: Initialize terminal settings
+
+# Set terminal title
+
+function axzsh_terminal_precmd {
+       printf '\e]1;%s\a' "$LOGNAME@$SHORT_HOST"
+}
+
+precmd_functions+=(axzsh_terminal_precmd)
+
+# Set current working directory
+
+function axzsh_terminal_cwd {
+       if [[ $TERM_PROGRAM == Apple_Terminal ]]; then
+               local url="file://$HOSTNAME${PWD// /%20}"
+               printf '\e]7;%s\a' "$url"
+       fi
+}
+
+precmd_functions+=(axzsh_terminal_cwd)
+
+# Colors
+
+autoload -U colors
+colors
+
+# Text effects (FX)
+
+typeset -Ag fx
+fx=(
+       reset           "\e[00m"
+       bold            "\e[01m"
+       no-bold         "\e[22m"
+       italic          "\e[03m"
+       no-italic       "\e[23m"
+       underline       "\e[04m"
+       no-underline    "\e[24m"
+       blink           "\e[05m"
+       no-blink        "\e[25m"
+       reverse         "\e[07m"
+       no-reverse      "\e[27m"
+)
diff --git a/core/20_home/20_home.zprofile b/core/20_home/20_home.zprofile
new file mode 100644 (file)
index 0000000..c02172e
--- /dev/null
@@ -0,0 +1,24 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 20_home.zprofile: Setup (local) home directory
+
+[[ -d "/usr/local/home" && ! -d "/usr/local/home/$LOGNAME" ]] \
+       && mkdir "/usr/local/home/$LOGNAME" >/dev/null 2>&1
+
+[[ -w "/usr/local/home/$LOGNAME" ]] \
+       && export LOCAL_HOME="/usr/local/home/$LOGNAME" \
+       || export LOCAL_HOME="$HOME"
+
+# Setup XDG cache directory
+export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
+mkdir -p "$XDG_CACHE_HOME"
+
+# Setup ZSH cache directory
+export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh"
+mkdir -p "$ZSH_CACHE_DIR"
+
+# Update PATH to include directories inside of the $HOME directory
+typeset -U path
+for dir in ~/bin ~/sbin ~/Applications; do
+       [[ -d "$dir" ]] && path[1,0]="$dir"
+done
+unset dir
diff --git a/core/30_hostname/30_hostname.zprofile b/core/30_hostname/30_hostname.zprofile
new file mode 100644 (file)
index 0000000..a4bba5d
--- /dev/null
@@ -0,0 +1,12 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 30_hostname.zprofile: Initialize hostname settings
+
+# Setup "HOSTNAME" variable
+[[ -z "$HOSTNAME" ]] && HOSTNAME=$( hostname )
+export HOSTNAME
+
+# Setup "SHORT_HOST" variable
+[[ "$OSTYPE" = darwin* ]] \
+       && SHORT_HOST=$(scutil --get ComputerName 2>/dev/null)
+[[ -z "$SHORT_HOST" ]] && SHORT_HOST=${HOST/.*/}
+export SHORT_HOST
diff --git a/core/50_prompt/50_prompt.zshrc b/core/50_prompt/50_prompt.zshrc
new file mode 100644 (file)
index 0000000..5dc89d9
--- /dev/null
@@ -0,0 +1,76 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 50_prompt.zshrc: Setup default prompts
+
+# Logname ("user name")
+
+(( $UID == 0 )) \
+       && ZSH_THEME_LOGNAME_PROMPT_PREFIX="%{$fg_no_bold[red]%}" \
+       || ZSH_THEME_LOGNAME_PROMPT_PREFIX=""
+ZSH_THEME_LOGNAME_PROMPT_SUFFIX="%{$reset_color%}@"
+
+function ax_logname_prompt_root() {
+       (( $UID == 0 )) || return 1
+       echo "$LOGNAME"
+       return 0
+}
+
+ax_logname_prompt_functions=($ax_logname_prompt_functions ax_logname_prompt_root)
+
+function ax_logname_prompt() {
+       local func
+       local p
+       for func ($ax_logname_prompt_functions); do
+               p=$( $func ) || continue
+               echo "${ZSH_THEME_LOGNAME_PROMPT_PREFIX}${p}${ZSH_THEME_LOGNAME_PROMPT_SUFFIX}"
+               return
+       done
+}
+
+# Hostname
+
+ZSH_THEME_HOSTNAME_PROMPT_PREFIX=""
+ZSH_THEME_HOSTNAME_PROMPT_SUFFIX="%{$reset_color%}:"
+
+function ax_hostname_prompt_root() {
+       (( $UID == 0 )) || return 1
+       echo "$SHORT_HOST"
+       return 0
+}
+
+ax_hostname_prompt_functions=($ax_hostname_prompt_functions ax_hostname_prompt_root)
+
+function ax_hostname_prompt() {
+       local func
+       local p
+       for func ($ax_hostname_prompt_functions); do
+               p=$( $func ) || continue
+               echo "${ZSH_THEME_HOSTNAME_PROMPT_PREFIX}${p}${ZSH_THEME_HOSTNAME_PROMPT_SUFFIX}"
+               return
+       done
+}
+
+# VCS
+
+ZSH_THEME_VCS_PROMPT_PREFIX="(%{$fg_no_bold[yellow]%}"
+ZSH_THEME_VCS_PROMPT_SUFFIX="%{$reset_color%}) "
+
+ZSH_THEME_VCS_PROMPT_CLEAN="%{$fg_no_bold[green]%}✔"
+ZSH_THEME_VCS_PROMPT_DIRTY="%{$fg_no_bold[red]%}✘"
+ZSH_THEME_VCS_PROMPT_AHEAD="%{$fg_no_bold[cyan]%}→"
+ZSH_THEME_VCS_PROMPT_BEHIND="%{$fg_no_bold[blue]%}←"
+
+function ax_vcs_prompt() {
+       local func
+       local p
+       for func ($ax_vcs_prompt_functions); do
+               p=$( $func ) || continue
+               echo "${ZSH_THEME_VCS_PROMPT_PREFIX}${p}${ZSH_THEME_VCS_PROMPT_SUFFIX}"
+               return
+       done
+}
+
+# Options and defaults
+
+setopt PROMPT_SUBST
+
+export PS1 RPS1
diff --git a/core/80_local_config/80_local_config.zlogin b/core/80_local_config/80_local_config.zlogin
new file mode 100644 (file)
index 0000000..d58c57e
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 80_local_config.zlogin: Read local configuration
+
+[[ -r "/var/lib/$HOST/zlogin" ]] \
+       && source "/var/lib/$HOST/zlogin"
diff --git a/core/80_local_config/80_local_config.zlogout b/core/80_local_config/80_local_config.zlogout
new file mode 100644 (file)
index 0000000..820c023
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 80_local_config.zlogout: Read local configuration
+
+[[ -r "/var/lib/$HOST/zlogout" ]] \
+       && source "/var/lib/$HOST/zlogout"
diff --git a/core/80_local_config/80_local_config.zprofile b/core/80_local_config/80_local_config.zprofile
new file mode 100644 (file)
index 0000000..9a4703a
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 80_local_config.zprofile: Read local configuration
+
+[[ -r "/var/lib/$HOST/zprofile" ]] \
+       && source "/var/lib/$HOST/zprofile"
diff --git a/core/80_local_config/80_local_config.zshrc b/core/80_local_config/80_local_config.zshrc
new file mode 100644 (file)
index 0000000..8bd514a
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 80_local_config.zshrc: Read local configuration
+
+[[ -r "/var/lib/$HOST/zshrc" ]] \
+       && source "/var/lib/$HOST/zshrc"
diff --git a/core/90_completion_init/90_completion_init.zshrc b/core/90_completion_init/90_completion_init.zshrc
new file mode 100644 (file)
index 0000000..ed7ff16
--- /dev/null
@@ -0,0 +1,13 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# completion.zshrc: Setup completion
+
+# Make sure that "compinit" is available
+type compinit >/dev/null || return
+
+# Save the location of the current completion dump file.
+if [[ -z "$ZSH_COMPDUMP" ]]; then
+       ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
+fi
+
+# Initialize ZSH completion system
+compinit -d "$ZSH_COMPDUMP"
diff --git a/install.sh b/install.sh
new file mode 100755 (executable)
index 0000000..8cb92e3
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# AX-ZSH: Alex' Modular ZSH Configuration
+# Copyright (c) 2015 Alexander Barton <alex@barton.de>
+#
+
+safe_rm() {
+       if [ -f "$1" -a ! -L "$1" ]; then
+               rm -f "$1.bak" || exit 1
+               mv -v "$1" "$1.bak" || exit 1
+       fi
+       rm -f "$1" || exit 1
+}
+
+for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
+       safe_rm "$f" || exit 1
+       ln -sv "$PWD/ax.zsh" "$f" || exit 1
+done
+
+safe_rm ~/.axzsh || exit 1
+ln -sv "$PWD" ~/.axzsh || exit 1
diff --git a/plugins/byebye/byebye.zlogout b/plugins/byebye/byebye.zlogout
new file mode 100644 (file)
index 0000000..7c06d38
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# byebye.zlogout -- Say goodbye to interactive users
+
+[[ -o interactive ]] \
+       && echo "Bye, bye, $LOGNAME!"
diff --git a/plugins/completion/completion.zshrc b/plugins/completion/completion.zshrc
new file mode 100644 (file)
index 0000000..7588385
--- /dev/null
@@ -0,0 +1,14 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# completion.zshrc: Setup completion
+
+autoload -U compinit
+
+setopt completealiases
+
+zstyle ':completion:*' list-colors ''
+zstyle ':completion:*' menu select
+zstyle ':completion:*' special-dirs true
+
+# Use caching so that commands like apt and dpkg completions are useable
+zstyle ':completion::complete:*' use-cache 1
+zstyle ':completion::complete:*' cache-path "$ZSH_CACHE_DIR"
diff --git a/plugins/correction/correction.zshrc b/plugins/correction/correction.zshrc
new file mode 100644 (file)
index 0000000..657aece
--- /dev/null
@@ -0,0 +1,18 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# correction.zshrc: Setup correction
+
+for cmd in \
+       brew \
+       ebuild \
+       gist \
+       man \
+       mkdir \
+       mv \
+       mysql \
+       sudo \
+; do
+       [[ -n $commands[$cmd] ]] \
+               && alias $cmd="nocorrect $cmd"
+done
+
+setopt correct_all
diff --git a/plugins/git/git.zshrc b/plugins/git/git.zshrc
new file mode 100644 (file)
index 0000000..11ac2be
--- /dev/null
@@ -0,0 +1,51 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# git.zshrc: Setup Git
+
+# Make sure that "git(1)" is installed
+(( $+commands[git] )) || return
+
+git_parse_dirty() {
+       local flags
+       flags=(
+               '--porcelain'
+               '--ignore-submodules=dirty'
+               #'--untracked-files=no'
+       )
+       [[ -n "$(git status $flags 2>/dev/null | tail -n1)" ]] \
+               && echo "$ZSH_THEME_VCS_PROMPT_DIRTY" \
+               || echo "$ZSH_THEME_VCS_PROMPT_CLEAN"
+}
+
+git_current_branch() {
+       local ref=$(git symbolic-ref --quiet HEAD 2>/dev/null)
+       local ret=$?
+       if [[ $ret != 0 ]]; then
+               [[ $ret == 128 ]] && return             # No Git repository
+               ref=$(git rev-parse --short HEAD 2>/dev/null) || return
+       fi
+       echo "${ref#refs/heads/}"
+}
+
+git_prompt_ahead() {
+       [[ -n "$(git rev-list "@{upstream}..HEAD" 2>/dev/null)" ]] \
+               && echo "$ZSH_THEME_VCS_PROMPT_AHEAD"
+}
+
+git_prompt_behind() {
+       [[ -n "$(git rev-list HEAD..@{upstream} 2>/dev/null)" ]] \
+               && echo "$ZSH_THEME_VCS_PROMPT_BEHIND"
+}
+
+git_prompt() {
+       ref=$(git symbolic-ref HEAD 2>/dev/null) || return 1
+       echo "${ref#refs/heads/} $(git_parse_dirty)$(git_prompt_ahead)$(git_prompt_behind)"
+       return 0
+}
+
+ax_vcs_prompt_functions=($ax_vcs_prompt_functions git_prompt)
+
+alias "ga"="git add"
+alias "gc"="git commit"
+alias "gd"="git diff"
+alias "gdc"="git diff --cached"
+alias "gst"="git status --short --branch --untracked"
diff --git a/plugins/history/history.zshrc b/plugins/history/history.zshrc
new file mode 100644 (file)
index 0000000..6470c43
--- /dev/null
@@ -0,0 +1,18 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# history.zshrc: Setup ZSH history
+
+[[ -z "$HISTFILE" ]] && HISTFILE="$HOME/.zsh_history"
+
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt append_history
+setopt extended_history
+setopt hist_expire_dups_first
+setopt hist_ignore_dups
+setopt hist_ignore_space
+setopt hist_verify
+setopt inc_append_history
+setopt share_history
+
+alias history='fc -il 1'
diff --git a/plugins/homebrew/homebrew.zshrc b/plugins/homebrew/homebrew.zshrc
new file mode 100644 (file)
index 0000000..24731ca
--- /dev/null
@@ -0,0 +1,8 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# homebrew.zshrc -- Setup Homebrew Package Manager
+
+# Make sure that "brew(1)" is installed
+(( $+commands[brew] )) || return
+
+[[ -d "/usr/local/share/zsh-completions" ]] \
+       && fpath=(/usr/local/share/zsh-completions $fpath)
diff --git a/plugins/ls/ls.zshrc b/plugins/ls/ls.zshrc
new file mode 100644 (file)
index 0000000..8ac3ba0
--- /dev/null
@@ -0,0 +1,20 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# ls.zshrc: Setup ls(1)
+
+# Check which ls-alike command to use
+if (( $+commands[gls] )); then
+       cmd="gls"       # GNU ls (on NetBSD, for example)
+elif (( $+commands[colorls] )); then
+       cmd="colorls"   # OpenBSD
+else
+       cmd="ls"
+fi
+
+if $cmd --color -d . >/dev/null 2>&1; then
+       alias ls="$cmd -F --color=tty"
+       return 0
+fi
+if $cmd -G -d . >/dev/null 2>&1; then
+       alias ls="$cmd -FG"
+       return 0
+fi
diff --git a/plugins/prompt/prompt.zlogin b/plugins/prompt/prompt.zlogin
new file mode 100644 (file)
index 0000000..eeda754
--- /dev/null
@@ -0,0 +1,8 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# prompt.zlogin: Setup default prompts
+
+# Default prompt
+PS1='$(ax_logname_prompt)$(ax_hostname_prompt)%B%2~%b $(ax_vcs_prompt)%{$fg_no_bold[green]%}%B$%b%{$reset_color%} '
+
+# Prompt on right side
+RPS1="%(?..%{$fg_no_bold[red]%}%? ↵%{$reset_color%})"
diff --git a/plugins/ssh/ssh.zshrc b/plugins/ssh/ssh.zshrc
new file mode 100644 (file)
index 0000000..de192b6
--- /dev/null
@@ -0,0 +1,18 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# ssh.zshrc: Setup (Open-) SSH
+
+ssh_logname_prompt() {
+       [[ -n "$SSH_CLIENT" ]] || return 1
+       echo "$LOGNAME"
+       return 0
+}
+
+ax_logname_prompt_functions=($ax_logname_prompt_functions ssh_logname_prompt)
+
+ssh_hostname_prompt() {
+       [[ -n "$SSH_CLIENT" ]] || return 1
+       echo "$SHORT_HOST"
+       return 0
+}
+
+ax_hostname_prompt_functions=($ax_hostname_prompt_functions ssh_hostname_prompt)
diff --git a/plugins/std_aliases/std_aliases.zshrc b/plugins/std_aliases/std_aliases.zshrc
new file mode 100644 (file)
index 0000000..11eb89a
--- /dev/null
@@ -0,0 +1,7 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# std_aliases: Setup standard aliases
+
+alias ".."="cd .."
+
+alias "ll"="ls -hl"
+alias "l"="ll -a"