]> arthur.barton.de Git - ax-zsh.git/commitdiff
Don't hardcode default plugins, read them from ./default_plugins/
authorAlexander Barton <alex@barton.de>
Thu, 30 Jul 2015 12:40:13 +0000 (14:40 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 30 Jul 2015 12:40:13 +0000 (14:40 +0200)
25 files changed:
ax.zsh
default_plugins/byebye/byebye.zlogout [new file with mode: 0644]
default_plugins/correction/correction.zshrc [new file with mode: 0644]
default_plugins/grep/grep.zshrc [new file with mode: 0644]
default_plugins/history/history.zshrc [new file with mode: 0644]
default_plugins/less/less.zprofile [new file with mode: 0644]
default_plugins/ls/ls.zshrc [new file with mode: 0644]
default_plugins/prompt/prompt.zlogin [new file with mode: 0644]
default_plugins/ssh/ssh.zprofile [new file with mode: 0644]
default_plugins/ssh/ssh.zshrc [new file with mode: 0644]
default_plugins/std_aliases/std_aliases.zshrc [new file with mode: 0644]
default_plugins/std_env/std_env.zprofile [new file with mode: 0644]
default_plugins/std_options/std_options.zshrc [new file with mode: 0644]
plugins/byebye/byebye.zlogout [deleted file]
plugins/correction/correction.zshrc [deleted file]
plugins/grep/grep.zshrc [deleted file]
plugins/history/history.zshrc [deleted file]
plugins/less/less.zprofile [deleted file]
plugins/ls/ls.zshrc [deleted file]
plugins/prompt/prompt.zlogin [deleted file]
plugins/ssh/ssh.zprofile [deleted file]
plugins/ssh/ssh.zshrc [deleted file]
plugins/std_aliases/std_aliases.zshrc [deleted file]
plugins/std_env/std_env.zprofile [deleted file]
plugins/std_options/std_options.zshrc [deleted file]

diff --git a/ax.zsh b/ax.zsh
index b3d6d57e6b49aed45d0b1759c1752e12f9d8dd84..ab89ea4c1f00bf168c26946737a066ea49c74933 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -17,6 +17,7 @@ function axzsh_load_plugin {
                "$AXZSH_PLUGIN_D/$plugin"
                "$ZSH_CUSTOM/$plugin"
                "$AXZSH/plugins/$plugin"
+               "$AXZSH/default_plugins/$plugin"
                "$AXZSH/core/$plugin"
        ); do
                [[ ! -d "$dname" ]] && continue
@@ -67,17 +68,7 @@ fi
 typeset -U axzsh_default_plugins
 if ! typeset +m axzsh_default_plugins | fgrep array >/dev/null 2>&1; then
        axzsh_default_plugins=(
-               byebye
-               correction
-               grep
-               history
-               less
-               ls
-               prompt
-               ssh
-               std_aliases
-               std_env
-               std_options
+               $AXZSH/default_plugins/*
        )
 fi
 
diff --git a/default_plugins/byebye/byebye.zlogout b/default_plugins/byebye/byebye.zlogout
new file mode 100644 (file)
index 0000000..06df9c5
--- /dev/null
@@ -0,0 +1,15 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# byebye.zlogout -- Say goodbye to interactive users
+
+[[ -o interactive ]] || return
+
+# Clear the console if it is a local terminal
+case `tty` in
+    /dev/tty[0-9]*|/dev/ttyS[0-9]*)
+       [[ -x /usr/bin/clear_console ]] \
+               && /usr/bin/clear_console --quiet \
+               || clear
+       ;;
+    *)
+       echo "Bye, bye, $LOGNAME!"
+esac
diff --git a/default_plugins/correction/correction.zshrc b/default_plugins/correction/correction.zshrc
new file mode 100644 (file)
index 0000000..b2412f6
--- /dev/null
@@ -0,0 +1,21 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# correction.zshrc: Setup correction
+
+for cmd (
+       apt
+       aptitude
+       brew
+       ebuild
+       gist
+       man
+       mkdir
+       mv
+       mysql
+       pkg_add
+       sudo
+); do
+       [[ -n $commands[$cmd] ]] \
+               && alias $cmd="nocorrect $cmd"
+done
+
+setopt correct_all
diff --git a/default_plugins/grep/grep.zshrc b/default_plugins/grep/grep.zshrc
new file mode 100644 (file)
index 0000000..f83468a
--- /dev/null
@@ -0,0 +1,30 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# grep.zshrc: Setup grep
+
+# Make sure that "grep(1)" is installed
+(( $+commands[grep] )) || return
+
+grep-flag-available() {
+       echo | grep "$1" "" >/dev/null 2>&1
+}
+
+grep_options=""
+vcs_folders="{.bzr,.cvs,.git,.hg,.svn}"
+
+# Color
+if grep-flag-available "--color=auto"; then
+       grep_options+=" --color=auto"
+fi
+
+# Exclude VCS folders
+if grep-flag-available "--exclude-dir=.csv"; then
+       grep_options+=" --exclude-dir=$vcs_folders"
+elif grep-flag-available "--exclude=.csv"; then
+       grep_options+=" --exclude=$vcs_folders"
+fi
+
+[[ -n "$options" ]] && alias grep="grep${grep_options}"
+
+unfunction grep-flag-available
+unset grep_options
+unset vcs_folders
diff --git a/default_plugins/history/history.zshrc b/default_plugins/history/history.zshrc
new file mode 100644 (file)
index 0000000..a70d304
--- /dev/null
@@ -0,0 +1,24 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# history.zshrc: Setup ZSH history
+
+if [[ -z "$HISTFILE" ]]; then
+       # Save history file in cache directory, if not already present
+       # in $ZDOTDIR/$HOME:
+       [ -r "${ZDOTDIR:-$HOME}/.zsh_history" ] \
+               && HISTFILE="${ZDOTDIR:-$HOME}/.zsh_history" \
+               || HISTFILE="$ZSH_CACHE_DIR/history"
+fi
+
+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/default_plugins/less/less.zprofile b/default_plugins/less/less.zprofile
new file mode 100644 (file)
index 0000000..95fe642
--- /dev/null
@@ -0,0 +1,9 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# less.zprofile: Setup less
+
+# Make sure that "less(1)" is installed
+(( $+commands[less] )) || return
+
+export LESS="-FmRX"
+
+(( $+commands[lesspipe] )) && eval $(lesspipe)
diff --git a/default_plugins/ls/ls.zshrc b/default_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/default_plugins/prompt/prompt.zlogin b/default_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/default_plugins/ssh/ssh.zprofile b/default_plugins/ssh/ssh.zprofile
new file mode 100644 (file)
index 0000000..4c803fe
--- /dev/null
@@ -0,0 +1,13 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# ssh.zprofile: Setup (Open-) SSH
+
+# Make sure that "ssh(1)" is installed
+(( $+commands[ssh] )) || return
+
+unset ssh_cmd
+(( $+commands[ssh-q] )) && ssh_cmd="ssh-q"
+(( $+commands[ssh-wrapper] )) && ssh_cmd="ssh-wrapper"
+if [[ -n "$ssh_cmd" ]]; then
+       export GIT_SSH="$ssh_cmd"
+fi
+unset ssh_cmd
diff --git a/default_plugins/ssh/ssh.zshrc b/default_plugins/ssh/ssh.zshrc
new file mode 100644 (file)
index 0000000..c63985b
--- /dev/null
@@ -0,0 +1,21 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# ssh.zshrc: Setup (Open-) SSH
+
+# Make sure that "ssh(1)" is installed
+(( $+commands[ssh] )) || return
+
+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/default_plugins/std_aliases/std_aliases.zshrc b/default_plugins/std_aliases/std_aliases.zshrc
new file mode 100644 (file)
index 0000000..5cb4015
--- /dev/null
@@ -0,0 +1,10 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# std_aliases: Setup standard aliases
+
+alias ".."="cd .."
+
+alias "ll"="ls -hl"
+alias "l"="ll -a"
+
+alias lasth='last | head -n "$((LINES-1))"'
+alias lastf='last | grep -v "^$LOGNAME"'
diff --git a/default_plugins/std_env/std_env.zprofile b/default_plugins/std_env/std_env.zprofile
new file mode 100644 (file)
index 0000000..8556bae
--- /dev/null
@@ -0,0 +1,4 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# std_env: Setup standard environment variables
+
+export MANWIDTH="80"
diff --git a/default_plugins/std_options/std_options.zshrc b/default_plugins/std_options/std_options.zshrc
new file mode 100644 (file)
index 0000000..e691c21
--- /dev/null
@@ -0,0 +1,12 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# std_options.zshrc: Setup standard ZSH options
+
+# Change directories by just entering their names
+setopt auto_cd
+
+# Automatically push directories to the directory stack
+setopt autopushd
+setopt pushdignoredups
+
+# Recognize comments in interactive mode, too
+setopt interactivecomments
diff --git a/plugins/byebye/byebye.zlogout b/plugins/byebye/byebye.zlogout
deleted file mode 100644 (file)
index 06df9c5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# byebye.zlogout -- Say goodbye to interactive users
-
-[[ -o interactive ]] || return
-
-# Clear the console if it is a local terminal
-case `tty` in
-    /dev/tty[0-9]*|/dev/ttyS[0-9]*)
-       [[ -x /usr/bin/clear_console ]] \
-               && /usr/bin/clear_console --quiet \
-               || clear
-       ;;
-    *)
-       echo "Bye, bye, $LOGNAME!"
-esac
diff --git a/plugins/correction/correction.zshrc b/plugins/correction/correction.zshrc
deleted file mode 100644 (file)
index b2412f6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# correction.zshrc: Setup correction
-
-for cmd (
-       apt
-       aptitude
-       brew
-       ebuild
-       gist
-       man
-       mkdir
-       mv
-       mysql
-       pkg_add
-       sudo
-); do
-       [[ -n $commands[$cmd] ]] \
-               && alias $cmd="nocorrect $cmd"
-done
-
-setopt correct_all
diff --git a/plugins/grep/grep.zshrc b/plugins/grep/grep.zshrc
deleted file mode 100644 (file)
index f83468a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# grep.zshrc: Setup grep
-
-# Make sure that "grep(1)" is installed
-(( $+commands[grep] )) || return
-
-grep-flag-available() {
-       echo | grep "$1" "" >/dev/null 2>&1
-}
-
-grep_options=""
-vcs_folders="{.bzr,.cvs,.git,.hg,.svn}"
-
-# Color
-if grep-flag-available "--color=auto"; then
-       grep_options+=" --color=auto"
-fi
-
-# Exclude VCS folders
-if grep-flag-available "--exclude-dir=.csv"; then
-       grep_options+=" --exclude-dir=$vcs_folders"
-elif grep-flag-available "--exclude=.csv"; then
-       grep_options+=" --exclude=$vcs_folders"
-fi
-
-[[ -n "$options" ]] && alias grep="grep${grep_options}"
-
-unfunction grep-flag-available
-unset grep_options
-unset vcs_folders
diff --git a/plugins/history/history.zshrc b/plugins/history/history.zshrc
deleted file mode 100644 (file)
index a70d304..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# history.zshrc: Setup ZSH history
-
-if [[ -z "$HISTFILE" ]]; then
-       # Save history file in cache directory, if not already present
-       # in $ZDOTDIR/$HOME:
-       [ -r "${ZDOTDIR:-$HOME}/.zsh_history" ] \
-               && HISTFILE="${ZDOTDIR:-$HOME}/.zsh_history" \
-               || HISTFILE="$ZSH_CACHE_DIR/history"
-fi
-
-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/less/less.zprofile b/plugins/less/less.zprofile
deleted file mode 100644 (file)
index 95fe642..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# less.zprofile: Setup less
-
-# Make sure that "less(1)" is installed
-(( $+commands[less] )) || return
-
-export LESS="-FmRX"
-
-(( $+commands[lesspipe] )) && eval $(lesspipe)
diff --git a/plugins/ls/ls.zshrc b/plugins/ls/ls.zshrc
deleted file mode 100644 (file)
index 8ac3ba0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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
deleted file mode 100644 (file)
index eeda754..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# 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.zprofile b/plugins/ssh/ssh.zprofile
deleted file mode 100644 (file)
index 4c803fe..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# ssh.zprofile: Setup (Open-) SSH
-
-# Make sure that "ssh(1)" is installed
-(( $+commands[ssh] )) || return
-
-unset ssh_cmd
-(( $+commands[ssh-q] )) && ssh_cmd="ssh-q"
-(( $+commands[ssh-wrapper] )) && ssh_cmd="ssh-wrapper"
-if [[ -n "$ssh_cmd" ]]; then
-       export GIT_SSH="$ssh_cmd"
-fi
-unset ssh_cmd
diff --git a/plugins/ssh/ssh.zshrc b/plugins/ssh/ssh.zshrc
deleted file mode 100644 (file)
index c63985b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# ssh.zshrc: Setup (Open-) SSH
-
-# Make sure that "ssh(1)" is installed
-(( $+commands[ssh] )) || return
-
-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
deleted file mode 100644 (file)
index 5cb4015..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# std_aliases: Setup standard aliases
-
-alias ".."="cd .."
-
-alias "ll"="ls -hl"
-alias "l"="ll -a"
-
-alias lasth='last | head -n "$((LINES-1))"'
-alias lastf='last | grep -v "^$LOGNAME"'
diff --git a/plugins/std_env/std_env.zprofile b/plugins/std_env/std_env.zprofile
deleted file mode 100644 (file)
index 8556bae..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# std_env: Setup standard environment variables
-
-export MANWIDTH="80"
diff --git a/plugins/std_options/std_options.zshrc b/plugins/std_options/std_options.zshrc
deleted file mode 100644 (file)
index e691c21..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# AX-ZSH: Alex' Modular ZSH Configuration
-# std_options.zshrc: Setup standard ZSH options
-
-# Change directories by just entering their names
-setopt auto_cd
-
-# Automatically push directories to the directory stack
-setopt autopushd
-setopt pushdignoredups
-
-# Recognize comments in interactive mode, too
-setopt interactivecomments