rename files, to have a better series. also adjust keybindings
authorJoerg Jaspert <joerg@debian.org>
Sun, 7 Apr 2013 13:22:05 +0000 (15:22 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sun, 7 Apr 2013 13:22:05 +0000 (15:22 +0200)
should you have .local files, you need to follow:

55_KeyBindings -> 80_KeyBindings
65_Editor -> 60_Editor
90_Plugins -> 70_Plugins
92_Exec -> 90_Exec
95_tmuxscreen -> removed, merged into 90_Exec

keybinding changes:
Up/Down are bound to history-substring-search-{up,down}, not up-line-or-search
PageUp/Down are bound to history-beginning-search-{back,for}ward-end

.zsh/60_Editor.zsh [moved from .zsh/65_Editor.zsh with 100% similarity]
.zsh/70_Plugins.zsh [new file with mode: 0644]
.zsh/80_KeyBindings.zsh [moved from .zsh/55_KeyBindings.zsh with 84% similarity]
.zsh/90_Exec.zsh [moved from .zsh/95_tmuxscreen.zsh with 83% similarity]
.zsh/90_Plugins.zsh [deleted file]
.zsh/92_Exec.zsh [deleted file]

similarity index 100%
rename from .zsh/65_Editor.zsh
rename to .zsh/60_Editor.zsh
diff --git a/.zsh/70_Plugins.zsh b/.zsh/70_Plugins.zsh
new file mode 100644 (file)
index 0000000..6e7e047
--- /dev/null
@@ -0,0 +1,52 @@
+# -*- mode: sh;-*-
+
+# Config for plugins loaded below
+
+
+# for per-directory-history
+HISTORY_BASE=${ZDOTDIR}/var/dirhist
+mkdir -p ${HISTORY_BASE}
+
+function bindkey() {
+    if zstyle -t ':ganneff:config' pluginbindkeys; then
+        # User allows plugins to bind keys
+        builtin bindkey "$@"
+        [[ "${DEBUG}" = "no" ]] && return
+        print -b -r "$fg_no_bold[cyan]plugin allowed to run${reset_color}: 'bindkey ${(q-)@}'"
+    else
+        [[ "${DEBUG}" = "no" ]] && return
+        print -b -r "$fg_no_bold[red]plugin forbidden to run${reset_color}: 'bindkey ${(q-)@}'"
+    fi
+}
+
+__ () {
+    local plugdir=${ZDOTDIR}/plugins
+    if [ -d ${plugdir} ]; then
+        typeset -a plugins
+        zstyle -a ':ganneff:config' plugins plugins \
+            || plugins=(
+            git-extras.plugin.zsh
+            history-substring-search.zsh
+            per-directory-history.plugin.zsh
+        )
+        for file in $plugins; do
+            debug "PLUGIN: Trying to load ${file}"...
+            source ${plugdir}/${file}
+            debug "PLUGIN: $fg_no_bold[green]done"
+        done
+    fi
+
+    # And now (possibly) oh-my-zsh style plugins
+    if [[ -d ${ZDOTDIR}/plugins/ohmy ]]; then
+        typeset -a omplug
+        zstyle -a ':ganneff:config' ohmyplugins omplug
+        for plug in ${omplug}; do
+            if [[ -f ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh ]]; then
+                source ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh
+            fi
+        done
+    fi
+} && __
+
+unfunction bindkey
+
similarity index 84%
rename from .zsh/55_KeyBindings.zsh
rename to .zsh/80_KeyBindings.zsh
index 3acea07..d884c35 100644 (file)
@@ -2,6 +2,7 @@
 ###
 # Key Bindings
 zmodload zsh/terminfo
+
 typeset -gA key_info
 key_info=(
   'Control'   '\C-'
@@ -95,8 +96,10 @@ zle -N insert-unicode-char
 zle -C hist-complete complete-word _generic
 zstyle ':completion:hist-complete:*' completer _history
 
-accept-line
+zle -N history-beginning-search-backward-end history-search-end
+zle -N history-beginning-search-forward-end  history-search-end
 
+accept-line
 
 bind2maps emacs             -- Home      beginning-of-somewhere
 bind2maps       viins vicmd -- Home      vi-beginning-of-line
@@ -106,8 +109,8 @@ bind2maps emacs viins       -- Insert    overwrite-mode
 bind2maps             vicmd -- Insert    vi-insert
 bind2maps emacs             -- Delete    delete-char
 bind2maps       viins vicmd -- Delete    vi-delete-char
-bind2maps emacs viins vicmd -- Up        up-line-or-search
-bind2maps emacs viins vicmd -- Down      down-line-or-search
+bind2maps emacs viins vicmd -- Up        history-substring-search-up
+bind2maps emacs viins vicmd -- Down      history-substring-search-down
 bind2maps emacs             -- Left      backward-char
 bind2maps       viins vicmd -- Left      vi-backward-char
 bind2maps emacs             -- Right     forward-char
@@ -116,6 +119,11 @@ bind2maps       viins vicmd -- Right     vi-forward-char
 bind2maps emacs             -- Backspace backward-delete-char
 bind2maps       viins vicmd -- Backspace vi-backward-delete-char
 
+#k# search history backward for entry beginning with typed text
+bind2maps emacs viins       -- PageUp history-beginning-search-backward-end
+#k# search history forward for entry beginning with typed text
+bind2maps emacs viins       -- PageDown history-beginning-search-forward-end
+
 # Setup some more bindings to be more like emacs.
 bind2maps emacs             -- -s "$key_info[Escape]b"                emacs-backward-word
 bind2maps viins vicmd       -- -s "$key_info[Escape]b"                vi-backward-word
@@ -154,21 +162,29 @@ bind2maps emacs viins       -- -s "$key_info[Escape]v"                slash-back
 bind2maps emacs viins       -- -s "$key_info[Escape]$key_info[Backspace]" slash-backward-kill-word
 #k# Kill left-side word or everything up to next slash
 bind2maps emacs viins       -- -s "$key_info[Escape]$key_info[Delete]" slash-backward-kill-word
+
 #k# Trigger menu-complete
-bind2maps emacs viins       -- -s '\ei' menu-complete  # menu completion via esc-i
+bind2maps emacs viins       -- -s '\ei'  menu-complete
 #k# jump to after first word (for adding options)
-bind2maps emacs viins       -- -s '^x1' jump_after_first_word
+bind2maps emacs viins       -- -s '^x1'  jump_after_first_word
 #k# complete word from history with menu
 bind2maps emacs viins       -- -s "^x^x" hist-complete
 # insert unicode character
 # usage example: 'ctrl-x i' 00A7 'ctrl-x i' will give you an <A7>
 # See for example http://unicode.org/charts/ for unicode characters code
 #k# Insert Unicode character
-bind2maps emacs viins       -- -s '^xi' insert-unicode-char
-
+bind2maps emacs viins       -- -s '^xi'  insert-unicode-char
+#k# Toggle per directory history
+bind2maps emacs viins vicmd -- -s '^X^G' per-directory-history-toggle-history
+#k# search history backward for entry matching typed text
+bind2maps emacs             -- -s "$key_info[Control]P" history-substring-search-up
+bind2maps             vicmd -- -s "k"                   history-substring-search-up
+#k# search history forward for entry matching typed text
+bind2maps emacs             -- -s "$key_info[Control]N" history-substring-search-down
+bind2maps             vicmd -- -s "j"                   history-substring-search-down
 
 #k# Insert files and test globbing
-is4 && bind2maps emacs viins -- -s "$keyinfo[Control]Xf"              insert-files
+is4 && bind2maps emacs viins -- -s "$key_info[Control]Xf"              insert-files
 #k# Edit the current line in \kbd{\$EDITOR}
 is4 && bind2maps emacs viins -- -s "$key_info[Control]x$key_info[Control]e" edit-command-line
 #k# Magic history searching
similarity index 83%
rename from .zsh/95_tmuxscreen.zsh
rename to .zsh/90_Exec.zsh
index a16ce7e..8328a7c 100644 (file)
@@ -1,5 +1,12 @@
 # -*- mode: sh;-*-
 
+if is-callable fortune && zstyle -T ':ganneff:config' fortune; then
+       preprint "Fortune" && echo
+       fortune | fmt -s -w 74
+       preprint && echo
+       echo
+fi | sed 's/^/   /'
+
 if zstyle -T ':ganneff:config' termstatus; then
     if is-callable tmux; then
         foo=$(tmux list-sessions 2>/dev/null)
diff --git a/.zsh/90_Plugins.zsh b/.zsh/90_Plugins.zsh
deleted file mode 100644 (file)
index 3f9a540..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- mode: sh;-*-
-
-# Config for plugins loaded below
-
-
-# for per-directory-history
-HISTORY_BASE=${ZDOTDIR}/var/dirhist
-mkdir -p ${HISTORY_BASE}
-
-debug ""
-if [ -d ${ZDOTDIR}/plugins ]; then
-    for file in ${ZDOTDIR}/plugins/*.zsh; do
-        debug "PLUGIN: Loading ${file}"... -n
-        source $file
-        debug "PLUGIN: $fg_no_bold[green]done"
-    done
-fi
diff --git a/.zsh/92_Exec.zsh b/.zsh/92_Exec.zsh
deleted file mode 100644 (file)
index fe0144d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- mode: sh;-*-
-
-if is-callable fortune && zstyle -T ':ganneff:config' fortune; then
-       preprint "Fortune" && echo
-       fortune | fmt -s -w 74
-       preprint && echo
-       echo
-fi | sed 's/^/   /'