Browse Source

Update zsh configuration to use zplug

Emmanuel Bouthenot 6 years ago
parent
commit
80c19bcd55

+ 0 - 17
.zsh/config/01_presto.zsh

@@ -1,17 +0,0 @@
-#
-# Load prezto
-#
-
-BUNDLES_ROOT="${ZSHDOTDIR}/bundles"
-PREZTO_INIT="${BUNDLES_ROOT}/prezto/init.zsh"
-if [ -f "${PREZTO_INIT}" ]; then
-    export ZDOTDIR="${BUNDLES_ROOT}"
-    source "${PREZTO_INIT}"
-    unset ZDOTDIR
-fi
-unset BUNDLES_ROOT PREZTO_INIT
-
-# Fix some prezto defaults
-if (( $+aliases[debi] )); then
-    unalias debi
-fi

+ 24 - 0
.zsh/config/01_prezto.zsh

@@ -0,0 +1,24 @@
+#
+# Prezto options
+#
+
+# Set case-sensitivity for completion, history lookup, etc.
+zstyle ':prezto:*:*' case-sensitive 'no'
+
+# Color output (auto set to 'no' on dumb terminals).
+zstyle ':prezto:*:*' color 'yes'
+
+# Set syntax highlighters. By default, only the main highlighter is enabled.
+zstyle ':prezto:module:syntax-highlighting' highlighters \
+  'main' \
+  'brackets' \
+  'pattern' \
+  'cursor'
+
+# Auto set the tab and window titles.
+zstyle ':prezto:module:terminal' auto-title 'yes'
+
+# debi alias conflicts debi provided by devscripts
+if (( $+aliases[debi] )); then
+    unalias debi
+fi

+ 3 - 3
.zsh/config/02_runasroot.zsh

@@ -2,12 +2,12 @@
 # Use the user zsh configuration as root
 #
 
-if [[ -n "$SUDO_USER" ]] && [[ "$UID" = 0 ]]; then
+if [[ -n "${SUDO_USER}" ]] && [[ "${UID}" = 0 ]]; then
     # define root history path
-    export HISTFILE="$ZSHDOTDIR/history/history_root"
+    export HISTFILE="${ZSHDOTDIR}/history/history_root"
     if [[ -f ~/.zcompdump ]]; then
         # ugly hack : reset some file perms to normal to avoid warnings
         chmod 0644 ~/.zcompdump
-        chown "$SUDO_USER:$SUDO_USER" ~/.zcompdump
+        chown "${SUDO_USER}:${SUDO_USER}" ~/.zcompdump
     fi
 fi

+ 3 - 1
.zsh/config/10_alias.zsh

@@ -23,7 +23,9 @@ export GIT_PAGER="$PAGER"
 # Common aliases / functions
 #
 
-alias l='ls -lsh'
+export QUOTING_STYLE='literal'
+alias ls='ls --group-directories-first --color=auto'
+alias l='ls --group-directories-first -lsh --color=auto'
 
 alias rm='rm -i'
 alias mv='mv -i'

+ 3 - 3
.zsh/config/12_history.zsh

@@ -7,11 +7,11 @@ setopt sharehistory         # _all_ zsh sessions share the same history files
 setopt histignorealldups    # ignores duplications
 
 HISTDIR="${ZSHDOTDIR}/history"
-if [ ! -d "$HISTDIR" ]; then
-    mkdir -p "$HISTDIR"
+if [ ! -d "${HISTDIR}" ]; then
+    mkdir -p "${HISTDIR}"
 fi
 
-HISTFILE="$HISTDIR/history"
+HISTFILE="${HISTDIR}/history"
 
 HISTSIZE=1000000
 SAVEHIST=1000000

+ 0 - 1
.zsh/config/13_options.zsh

@@ -20,7 +20,6 @@ setopt auto_list            # list choice on ambiguous command
 setopt auto_pushd           # cd = pushd
 setopt pushd_ignore_dups    # ignore dups in pushd
 setopt pushd_silent         # don't print stack after push/pop
-setopt bang_hist            # yeah ! expansion (use bash !$ for example)
 setopt chase_links          # cd to a symlink is in fact cd to the true dir
 setopt ksh_option_print     # modify setopt output
 setopt long_list_jobs       # list jobs in long format

+ 1 - 1
.zsh/config/50_debian.zsh

@@ -48,7 +48,7 @@ dbug() {
 
 # specific completions
 # rdebsign is a trivial shell script wrapper around debsign
-#compdef rdebsign=scp
+compdef rdebsign=scp
 
 # building environements
 cow-dist() {

+ 30 - 9
.zshrc

@@ -6,14 +6,35 @@
 #  but WITHOUT ANY WARRANTY
 #
 
-# Define personal zsh config directory
-export ZSHDOTDIR="${HOME}/.zsh"
+source ~/.zplug/init.zsh
 
-# Include custom configuration
-for f in ${ZSHDOTDIR}/config/*.zsh; do
-    if [[ -r "${f}" ]]; then
-        . "${f}"
-    fi
-done
+export ZSHDOTDIR=~/.zsh
 
-unset ZSHDOTDIR
+zplug "modules/archive", from:prezto
+zplug "modules/completion", from:prezto
+zplug "modules/directory", from:prezto
+zplug "modules/dpkg", from:prezto
+zplug "modules/editor", from:prezto
+zplug "modules/environment", from:prezto
+zplug "modules/terminal", from:prezto
+zplug "modules/editor", from:prezto
+zplug "modules/git", from:prezto
+zplug "modules/history", from:prezto
+zplug "modules/directory", from:prezto
+zplug "modules/spectrum", from:prezto
+zplug "modules/rsync", from:prezto
+zplug "modules/tmux", from:prezto
+zplug "modules/syntax-highlighting", from:prezto, defer:2
+zplug "modules/history-substring-search", from:prezto
+zplug "mafredri/zsh-async"
+zplug "k0lter/zsh-themes", as:theme
+
+if [[ -d "${ZSHDOTDIR}/config" ]]; then
+    zplug "${ZSHDOTDIR}/config", from:local, defer:1
+fi
+
+if ! zplug check --verbose; then
+    zplug install
+fi
+
+zplug load