summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user:hugues/Bindings28
-rw-r--r--user:hugues/Environment.zsh4
-rw-r--r--user:hugues/KeyBindings.zsh93
3 files changed, 84 insertions, 41 deletions
diff --git a/user:hugues/Bindings b/user:hugues/Bindings
index f7b0b54..301eb28 100644
--- a/user:hugues/Bindings
+++ b/user:hugues/Bindings
@@ -1,7 +1,6 @@
-#
-# 'bindkey -a' output
-#
-bindkey '#' set-mark-command
+## Résultat d'un ``bindkey''
+
+bindkey '#' set-mark-command
bindkey '^A' beginning-of-line
bindkey '^B' backward-char
bindkey '^D' delete-char-or-list
@@ -148,11 +147,11 @@ bindkey ' '-'~' self-insert
bindkey '' backward-delete-char
bindkey '\M-^@'-'\M-' self-insert
-#
-# Some personal bindings
-#
+# Raccourcis pour les todo : funny :)
+# 'q' stands for 'push-line'
-# 'q' stands for 'push-line', it's a good thing to use it :)
+bindkey -s 'r' 'Q rehash\n'
+bindkey -s 'R' 'Q reset\n'
bindkey -s 't' 'Q todo\n'
#bindkey -s 'T' 'Q todo all -c\n'
@@ -160,25 +159,20 @@ bindkey -s 't' 'Q todo\n'
bindkey -s 'é' ' 2>/dev/null '
bindkey -s '2' ' 2>&1 '
-bindkey -s 'm' 'Q make\n' # would be redefined as "mails" in some cases
+bindkey -s 'm' 'Q make\n'
bindkey -s 'M' 'Q make\n'
bindkey -s 'l' 'Q l\n'
-# conflicts with "lowercase word"
#bindkey -s 'L' 'Q la\n'
-#bindkey -s 'L' 'Q clear\n'
-bindkey -s ' ' '\\ ' # Very useful ! Mod-space escapes the space :)
+bindkey -s ' ' '\\ '
bindkey -s 'g' 'Q git-status\n'
bindkey -s 'G' 'Q git-repack -d -a\n'
-bindkey -s 'r' 'Q rehash\n'
-bindkey -s 'R' 'Q reset\n'
-
-# Very useful :)
bindkey -s 'S' 'Q sudo !!'
-# Restarts zsh to take our new config into account ;)
bindkey -s 'X' 'Q exec zsh\n'
+# conflicts with "lowercase word"
+#bindkey -s 'L' 'Q clear\n'
diff --git a/user:hugues/Environment.zsh b/user:hugues/Environment.zsh
index bd40e2f..2e4d302 100644
--- a/user:hugues/Environment.zsh
+++ b/user:hugues/Environment.zsh
@@ -48,11 +48,13 @@ TIMEFMT='`%J` -- %P cpu
System %S
Total %E'
-KEYTIMEOUT=1 # 0.01s
+KEYTIMEOUT=1 # 0,01 sec
+# Displays who is logging in or out
WATCHFMT=$c_$color[bold]$_c"%n"$c_$color[none]$_c" has "$c_$color[bold]$_c"%a"$c_$color[none]$_c" %l from %M"
WATCH=notme
+# Word delimiters
WORDCHARS='*?-_~!#$%^' ## Caractères faisant partie des mots
## J'ai viré les '/()[]{}'
diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh
index 5666dc3..bfdcba4 100644
--- a/user:hugues/KeyBindings.zsh
+++ b/user:hugues/KeyBindings.zsh
@@ -40,32 +40,79 @@ test $TERM = 'xterm' &&
bindkey 'OF' end-of-line # end-of-line
}
-#
-# First pass with my personal bindings in vicmd-mode
-#
-bindkey -A vicmd main ; source $0:h/Bindings
-# And here we re-define the 'push-line' macro
-bindkey -s "q" "iq"
-bindkey -s "Q" "iQ"
-
-# Second pass with my personal bindings in viins-mode
-bindkey -A viins main ; source $0:h/Bindings
-
-# Start every line editor in vicmd-mode.
-# 'bindkey -A vicmd main' is not the good way since
-# there is no way to enter viins-mode !!.. How tricky..
-zle-line-init() { zle vi-cmd-mode }
-zle -N zle-line-init
-# Go see man zshzle for more details.
-
-zle-keymap-select()
+set_keymap()
{
- # $1 is the old keymap
- # $KEYMAP is the new one
+ main=$1
+ bindkey -A main $main
+}
+# Vi-mode
+set_keymap viins
+
+for keymap in viins vicmd emacs
+do
+ bindkey -M $keymap -s 'r' 'Q rehash\n'
+ bindkey -M $keymap -s 'R' 'Q reset\n'
+
+ bindkey -M $keymap -s 't' 'Q todo\n'
+ #bindkey -M $keymap -s 'T' 'Q todo all -c\n'
+
+ bindkey -M $keymap -s 'é' ' 2>/dev/null '
+ bindkey -M $keymap -s '2' ' 2>&1 '
+
+ bindkey -M $keymap -s 'm' 'Q make\n'
+ bindkey -M $keymap -s 'M' 'Q make\n'
+
+ bindkey -M $keymap -s 'l' 'Q l\n'
+
+ bindkey -M $keymap -s ' ' '\\ '
+
+ bindkey -M $keymap -s 'g' 'Q git-status\n'
+ bindkey -M $keymap -s 'G' 'Q git-repack -d -a\n'
- local curr="$([ "$KEYMAP" = "main" ] && echo "viins" || echo $KEYMAP)"
+ bindkey -M $keymap -s 'S' 'Q sudo !!'
- term_title " [$curr]"
+ bindkey -M $keymap -s 'X' 'Q exec zsh\n'
+ bindkey -M $keymap -s 'OA' 'up-line-or-history'
+ bindkey -M $keymap -s 'OB' 'down-line-or-history'
+ bindkey -M $keymap -s 'OC' 'forward-word'
+ bindkey -M $keymap -s 'OD' 'backward-word'
+
+ bindkey -M $keymap "q" push-line
+ bindkey -M $keymap "Q" push-line
+done
+
+# redefines push-line for vicmd
+bindkey -M vicmd -s "q" "iq"
+bindkey -M vicmd -s "Q" "iQ"
+
+# Sets vicmd-mode vim-compliant
+bindkey -M vicmd "u" "undo"
+bindkey -M vicmd "" "redo"
+bindkey -M vicmd "j" "history-search-forward"
+bindkey -M viins "j" "history-search-forward"
+bindkey -M vicmd "k" "history-search-backward"
+bindkey -M viins "k" "history-search-backward"
+
+
+menuselect_vi-mode()
+{
+ # Sets menuselect vim-compliant
+ bindkey -M menuselect "j" "down-line-or-history"
+ bindkey -M menuselect "k" "up-line-or-history"
+ bindkey -M menuselect "h" "backward-char"
+ bindkey -M menuselect "l" "forward-char"
+}
+
+# Enters vi-cmd mode at each prompt
+#zle-line-init() { zle vi-cmd-mode }
+#zle -N zle-line-init
+
+# Show the current keymap used
+zle-keymap-select()
+{
+ local keymap=$( [ $KEYMAP = "main" ] && echo "$main" || echo $KEYMAP )
+ term_title " [$keymap]"
}
zle -N zle-keymap-select
+zle -N zle-line-init zle-keymap-select