From 083bbbb9c485df88e99d8bd9443d34d58b416e5c Mon Sep 17 00:00:00 2001 From: John-Paul Bader Date: Mon, 23 Apr 2012 22:11:24 +0200 Subject: [PATCH] Added initial .zsh configuration --- .zsh/lib/aliases.zsh | 3 ++ .zsh/lib/appearance.zsh | 35 +++++++++++++++++++ .zsh/lib/colors.zsh | 25 ++++++++++++++ .zsh/lib/completion.zsh | 73 +++++++++++++++++++++++++++++++++++++++ .zsh/lib/correction.zsh | 10 ++++++ .zsh/lib/directories.zsh | 4 +++ .zsh/lib/history.zsh | 13 +++++++ .zsh/lib/key_bindings.zsh | 51 +++++++++++++++++++++++++++ .zsh/lib/misc.zsh | 13 +++++++ .zshrc | 13 +++++++ 10 files changed, 240 insertions(+) create mode 100644 .zsh/lib/aliases.zsh create mode 100644 .zsh/lib/appearance.zsh create mode 100644 .zsh/lib/colors.zsh create mode 100644 .zsh/lib/completion.zsh create mode 100644 .zsh/lib/correction.zsh create mode 100644 .zsh/lib/directories.zsh create mode 100644 .zsh/lib/history.zsh create mode 100644 .zsh/lib/key_bindings.zsh create mode 100644 .zsh/lib/misc.zsh create mode 100644 .zshrc diff --git a/.zsh/lib/aliases.zsh b/.zsh/lib/aliases.zsh new file mode 100644 index 0000000..cca6881 --- /dev/null +++ b/.zsh/lib/aliases.zsh @@ -0,0 +1,3 @@ +alias ll='ls -la' +alias lh='ls -lah' +alias ...='cd ../..' \ No newline at end of file diff --git a/.zsh/lib/appearance.zsh b/.zsh/lib/appearance.zsh new file mode 100644 index 0000000..58194c5 --- /dev/null +++ b/.zsh/lib/appearance.zsh @@ -0,0 +1,35 @@ +# ls colors +autoload colors; colors; +export LSCOLORS="Gxfxcxdxbxegedabagacad" +#export LS_COLORS + +# Enable ls colors +if [ "$DISABLE_LS_COLORS" != "true" ] +then + # Find the option for using colors in ls, depending on the version: Linux or BSD + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' +fi + +#setopt no_beep +setopt auto_cd +setopt multios +setopt cdablevarS + +if [[ x$WINDOW != x ]] +then + SCREEN_NO="%B$WINDOW%b " +else + SCREEN_NO="" +fi + +# Apply theming defaults +PS1="%n@%m:%~%# " + +# git theming default: Variables for theming the git info prompt +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt +ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean + +# Setup the prompt with pretty colors +setopt prompt_subst \ No newline at end of file diff --git a/.zsh/lib/colors.zsh b/.zsh/lib/colors.zsh new file mode 100644 index 0000000..79ac2a5 --- /dev/null +++ b/.zsh/lib/colors.zsh @@ -0,0 +1,25 @@ +typeset -Ag FX FG BG + +LSCOLORS="exfxcxdxbxegedabagacad" +LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:" + +FX=( + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" +) + +for color in {000..255}; do + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" +done + +# Show all 256 colors with color number +function spectrum_ls() { + for code in {000..255}; do + print -P -- "$code: %F{$code}Test%f" + done +} \ No newline at end of file diff --git a/.zsh/lib/completion.zsh b/.zsh/lib/completion.zsh new file mode 100644 index 0000000..efe5a16 --- /dev/null +++ b/.zsh/lib/completion.zsh @@ -0,0 +1,73 @@ +# fixme - the load process here seems a bit bizarre + +unsetopt menu_complete # do not autoselect the first completion entry +unsetopt flowcontrol +setopt auto_menu # show completion menu on succesive tab press +setopt complete_in_word +setopt always_to_end + +WORDCHARS='' + +zmodload -i zsh/complist + +## case-insensitive (all),partial-word and then substring completion +if [ "x$CASE_SENSITIVE" = "xtrue" ]; then + zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + unset CASE_SENSITIVE +else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +fi + +# uncomment if completion should be colorful +# zstyle ':completion:*' list-colors '' + +# should this be in keybindings? +bindkey -M menuselect '^o' accept-and-infer-next-history + +zstyle ':completion:*:*:*:*:*' menu select +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' +zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories +cdpath=(.) + +# use /etc/hosts and known_hosts for hostname completion +[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(