chiark / gitweb /
dot/zprofile, dot/zshrc: Configuration for Zsh.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 6 Aug 2017 00:03:35 +0000 (01:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 6 Aug 2017 00:03:35 +0000 (01:03 +0100)
I'm trying this out to see whether I like it.  Current impressions are
good, but time will tell.

dot/zprofile [new file with mode: 0644]
dot/zshrc [new file with mode: 0644]
setup

diff --git a/dot/zprofile b/dot/zprofile
new file mode 100644 (file)
index 0000000..b421b3f
--- /dev/null
@@ -0,0 +1,8 @@
+### -*-sh-*-
+###
+### Zsh startup things.
+
+## Do the common shell profile things.
+. "$HOME/.profile"
+
+###----- That's all, folks --------------------------------------------------
diff --git a/dot/zshrc b/dot/zshrc
new file mode 100644 (file)
index 0000000..b4992b7
--- /dev/null
+++ b/dot/zshrc
@@ -0,0 +1,91 @@
+### -*-sh-*-
+###
+### Zsh session things.
+
+__mdw_shell=zsh
+case ${INSIDE_EMACS+t},$TERM in t,dumb) unsetopt zle ;; esac
+
+. "$HOME/.shell-rc"
+
+###--------------------------------------------------------------------------
+### Prompt hacking.
+
+__mdw_set_prompt_hacks () {
+  case $TERM in
+    linux*|screen*|xterm*|vt100*|eterm*)
+      bold=%B unbold=%b
+      gitcolour=%F{cyan} rccolour=%F{red} uncolour=%f
+      ;;
+  esac
+  host=%m dir=" %(6~!%-1~/.../%5~!%~)"
+}
+
+if [ -t 0 ]; then
+  __mdw_source_if_exists /usr/lib/git-core/git-sh-prompt
+  __mdw_set_prompt_pieces
+  precmd_functions+=(__mdw_precmd)
+  preexec_functions+=(__mdw_preexec)
+fi
+
+###--------------------------------------------------------------------------
+### Line editing.
+
+autoload -U select-word-style
+select-word-style bash
+bindkey -e
+
+###--------------------------------------------------------------------------
+### Completion.
+
+## Initialize the fancy completion machinery.
+autoload -Uz compinit
+compinit
+
+## Contexts: :completion:FUNCTION:COMPLETER:COMMAND:ARGUMENT:TAG
+zstyle ':completion:*' completer _expand _complete _ignored _approximate
+zstyle ':completion:*' insert-unambiguous false
+zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
+zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
+zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**' '+l:|=* r:|=*'
+zstyle ':completion:*' max-errors 0 numeric
+zstyle ':completion:*' original true
+zstyle ':completion:*' verbose false
+zstyle ':completion:*:*:git*:*' verbose true
+
+_r () { words[1]=sudo; _normal; }
+compdef _r rootly
+compdef _ssh @
+
+###--------------------------------------------------------------------------
+### Other shell tweaking.
+
+HISTFILE=~/.zsh-history
+HISTSIZE=1000
+SAVEHIST=1000
+
+setopt appendhistory
+unsetopt auto_cd
+unsetopt auto_menu
+unsetopt bash_auto_list
+unsetopt beep
+setopt extendedglob
+setopt ksh_glob
+setopt list_ambiguous
+setopt list_packed
+unsetopt nomatch
+unsetopt menu_complete
+setopt notify
+
+zshaddhistory () {
+  case "$1" in
+    " "*) return 2 ;;
+    *) return 0 ;;
+  esac
+}
+
+###--------------------------------------------------------------------------
+### Finishing touches.
+
+__mdw_source_if_exists "$HOME/.zshrc-local"
+
+###----- That's all, folks --------------------------------------------------
diff --git a/setup b/setup
index 622aac2b5af79812c9cb0542702634c4959b0fdc..dbc4b00e448cf2b00fb33dbc51d42bfbab29565b 100755 (executable)
--- a/setup
+++ b/setup
@@ -135,6 +135,7 @@ dotfiles="
   bash-profile:.bash_profile
   bash-completion:.bash_completion bashrc inputrc
   shrc
+  zprofile zshrc
   emacs emacs-calc vm gnus.el ercrc.el
   vimrc mg zile lesskey sqliterc
   parallel-config:.parallel/config