summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-19 17:10:53 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-19 17:10:53 +0200
commit086bd94740186f5d616eacc0e974ca68b220b0fb (patch)
treebc2ee05421167489bc66fff85d36474191498402
parent663aae703c712f014c33afc0d2fbc6d6eb34e280 (diff)
[Spaces Vs Tabs] 1 - 0
-rw-r--r--12_Prompts.zsh392
-rw-r--r--user:hugues/KeyBindings.zsh282
2 files changed, 336 insertions, 338 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 0bc82cf..ba8b7be 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -12,11 +12,11 @@ _prompt_colors[generic]=${PS1_USER:-}
if __privileged_user
then
- _prompt_colors[generic]=${PS1_ROOT:-$color[bold];$color[red]}
+ _prompt_colors[generic]=${PS1_ROOT:-$color[bold];$color[red]}
fi
if [ "$_yeahconsole" = "true" ]
then
- _prompt_colors[generic]=${PS1_YEAH}
+ _prompt_colors[generic]=${PS1_YEAH}
fi
__set_prompt_colors
@@ -31,63 +31,63 @@ PS1_EXTRA_INFO=()
## Automagic funcs
#
-# chpwd : changement de répertoire
-# preexec : avant d'exécuter une commande
-# precmd : avant d'afficher le prompt
+# chpwd : changement de répertoire
+# preexec : avant d'exécuter une commande
+# precmd : avant d'afficher le prompt
#
chpwd()
{
- __cmd_exists todo && todo
-
- if ( __cmd_exists git && test -d .git )
- then
- # Shows tracked branches and modified files
- git status | awk '
- BEGIN { YOURBRANCH=0 }
- {
- if (NR==2 && $0 ~ "^# Your branch ") { YOURBRANCH=1 }
- if ((NR>=2 && YOURBRANCH==0) || $0 ~ "^#$") { exit }
- if (YOURBRANCH==1) { print $0 }
- }
- ' | sed 's/^# / /'
- fi
+ __cmd_exists todo && todo
+
+ if ( __cmd_exists git && test -d .git )
+ then
+ # Shows tracked branches and modified files
+ git status | awk '
+ BEGIN { YOURBRANCH=0 }
+ {
+ if (NR==2 && $0 ~ "^# Your branch ") { YOURBRANCH=1 }
+ if ((NR>=2 && YOURBRANCH==0) || $0 ~ "^#$") { exit }
+ if (YOURBRANCH==1) { print $0 }
+ }
+ ' | sed 's/^# / /'
+ fi
}
preexec ()
{
- __term_title "$2"
+ __term_title "$2"
- __set_prompt_date exec
+ __set_prompt_date exec
- # Only redraws the date, not the full prompt, since we got glitches with BANG_HIST and AUTOCORRECT...
- tput sc # save cursor position
- up_up # go to start of current prompt
+ # Only redraws the date, not the full prompt, since we got glitches with BANG_HIST and AUTOCORRECT...
+ tput sc # save cursor position
+ up_up # go to start of current prompt
print -Pn "$(__show_date)" # prints date
- tput rc # restore cursor position
+ tput rc # restore cursor position
- print -Pn "$C_$_prompt_colors[exec]$_C"
+ print -Pn "$C_$_prompt_colors[exec]$_C"
}
__set_prompt_date()
{
- begin=${${1:+$_tj_}:-$_tk_}
- end=${${1:+$_tm_}:-$_tl_}
-
- # Date
- __debug -n " Date..."
- DATE=$C_$_prompt_colors[braces]$_C$T_"${begin}"$_T" "$C_$_date_colors[${1:-normal}]$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$_prompt_colors[braces]$_C" "$C_$_prompt_colors[bar]$_C$T_"${end}$_tq_"$_T
- DATEEXPAND=$(__expand_text "$DATE")
- DATESIZE=${#DATEEXPAND}
- __debug
+ begin=${${1:+$_tj_}:-$_tk_}
+ end=${${1:+$_tm_}:-$_tl_}
+
+ # Date
+ __debug -n " Date..."
+ DATE=$C_$_prompt_colors[braces]$_C$T_"${begin}"$_T" "$C_$_date_colors[${1:-normal}]$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$_prompt_colors[braces]$_C" "$C_$_prompt_colors[bar]$_C$T_"${end}$_tq_"$_T
+ DATEEXPAND=$(__expand_text "$DATE")
+ DATESIZE=${#DATEEXPAND}
+ __debug
}
__update_prompt_elements()
{
- __term_title
- __set_prompt_date
- __hbar
+ __term_title
+ __set_prompt_date
+ __hbar
CURDIR=$C_$_prompt_colors[path]$_C"%(!.%d.%~)"$C_$color[none]$_C
@@ -95,68 +95,68 @@ __update_prompt_elements()
__error_code ()
{
- # Error
- __debug -n " Error code..."
- echo ${ERROR:+$C_$_prompt_colors[error]$_C$ERROR}
- __debug
+ # Error
+ __debug -n " Error code..."
+ echo ${ERROR:+$C_$_prompt_colors[error]$_C$ERROR}
+ __debug
}
PS1_TASKBAR+=(__error_code)
__ssh_gpg_agents ()
{
- __debug -n " Agents..."
- # GPG/SSH agents
- AGENTS=""
+ __debug -n " Agents..."
+ # GPG/SSH agents
+ AGENTS=""
__debug
- __debug -n " ......SSH"
- # Check ssh-agent only if the env socket has been set and is accessible
- if [ -S "$SSH_AUTH_SOCK" ]
- then
- # Get keylist
- SSH_AGENT_KEYLIST="$( ssh-add -l | grep "^[[:digit:]]\+ \([[:digit:]a-f]\{2\}:\)\{15\}[[:digit:]a-f]\{2\} .* (.*)$" )"
- # Check if it is a forwarded agent
- if [ "$SSH_AGENT_PID" -gt 0 -a -e /proc/$SSH_AGENT_PID/cmdline ]
- then
- # That's a local agent
- if [ "$SSH_AGENT_KEYLIST" != "" ]
- then
- AgentChar=${AGENT_WITH_KEYS:-✔}
- for i in $(echo $SSH_AGENT_KEYLIST | cut -d' ' -f3 )
- do
- AGENTS=$AGENTS$C_${_agent_colors[$i:t]:-$_agent_colors[has_keys]}$_C$AgentChar
- done
- else
- AGENTCOLOR="empty"
- AgentChar=${AGENT_EMPTY:-✘}
- AGENTS=$C_$_agent_colors[$AGENTCOLOR]$_C"$AgentChar"
- fi
- else
- # That's a forwarded agent
- if [ "$SSH_AGENT_KEYLIST" != "" ]
- then
- AGENTCOLOR="has_remote_keys"
- AgentChar=${AGENT_SOCK_WITH_KEYS:-✓}
- else
- AGENTCOLOR="remote_empty"
- AgentChar=${AGENT_SOCK_EMPTY:-✗}
- fi
- AGENTS=$C_$_agent_colors[$AGENTCOLOR]$_C"$AgentChar"
- fi
- fi
+ __debug -n " ......SSH"
+ # Check ssh-agent only if the env socket has been set and is accessible
+ if [ -S "$SSH_AUTH_SOCK" ]
+ then
+ # Get keylist
+ SSH_AGENT_KEYLIST="$( ssh-add -l | grep "^[[:digit:]]\+ \([[:digit:]a-f]\{2\}:\)\{15\}[[:digit:]a-f]\{2\} .* (.*)$" )"
+ # Check if it is a forwarded agent
+ if [ "$SSH_AGENT_PID" -gt 0 -a -e /proc/$SSH_AGENT_PID/cmdline ]
+ then
+ # That's a local agent
+ if [ "$SSH_AGENT_KEYLIST" != "" ]
+ then
+ AgentChar=${AGENT_WITH_KEYS:-✔}
+ for i in $(echo $SSH_AGENT_KEYLIST | cut -d' ' -f3 )
+ do
+ AGENTS=$AGENTS$C_${_agent_colors[$i:t]:-$_agent_colors[has_keys]}$_C$AgentChar
+ done
+ else
+ AGENTCOLOR="empty"
+ AgentChar=${AGENT_EMPTY:-✘}
+ AGENTS=$C_$_agent_colors[$AGENTCOLOR]$_C"$AgentChar"
+ fi
+ else
+ # That's a forwarded agent
+ if [ "$SSH_AGENT_KEYLIST" != "" ]
+ then
+ AGENTCOLOR="has_remote_keys"
+ AgentChar=${AGENT_SOCK_WITH_KEYS:-✓}
+ else
+ AGENTCOLOR="remote_empty"
+ AgentChar=${AGENT_SOCK_EMPTY:-✗}
+ fi
+ AGENTS=$C_$_agent_colors[$AGENTCOLOR]$_C"$AgentChar"
+ fi
+ fi
__debug
- __debug -n " ......GPG"
- GPG_AGENT_PID="$(echo $GPG_AGENT_INFO | cut -d: -f2)"
- if [ "$GPG_AGENT_PID" != "" -a -e /proc/$GPG_AGENT_PID/cmdline ]
- then
- if [ "`strings /proc/$GPG_AGENT_PID/cmdline | head -n1`" = "gpg-agent" ]
- then
- AGENTCOLOR="has_keys"
- AGENTS=$AGENTS$C_$_agent_colors[$AGENTCOLOR]$_C${GPG_AGENT_RUNNING:-⚡}
- fi
- fi
- __debug
+ __debug -n " ......GPG"
+ GPG_AGENT_PID="$(echo $GPG_AGENT_INFO | cut -d: -f2)"
+ if [ "$GPG_AGENT_PID" != "" -a -e /proc/$GPG_AGENT_PID/cmdline ]
+ then
+ if [ "`strings /proc/$GPG_AGENT_PID/cmdline | head -n1`" = "gpg-agent" ]
+ then
+ AGENTCOLOR="has_keys"
+ AGENTS=$AGENTS$C_$_agent_colors[$AGENTCOLOR]$_C${GPG_AGENT_RUNNING:-⚡}
+ fi
+ fi
+ __debug
echo $AGENTS
}
@@ -171,104 +171,104 @@ __vcsbranch ()
local GITBRANCH GITBRANCHSIZE GITBRANCHCHUNK CHUNKABLE
local vcsbranch
- # get cvs tag
- #
- CVSTAG=""
- if [ -d CVS ]
- then
- __debug -n " CVS status..."
- CVSTAG=$(test -e CVS/Tag && cat CVS/Tag || basename $(cat CVS/Root 2>&- || echo "HEAD") )
- CVSTAG=${CVSTAG:+$C_$_gcl_colors[uptodate]$_C$CVSTAG}
- __debug
- fi
+ # get cvs tag
+ #
+ CVSTAG=""
+ if [ -d CVS ]
+ then
+ __debug -n " CVS status..."
+ CVSTAG=$(test -e CVS/Tag && cat CVS/Tag || basename $(cat CVS/Root 2>&- || echo "HEAD") )
+ CVSTAG=${CVSTAG:+$C_$_gcl_colors[uptodate]$_C$CVSTAG}
+ __debug
+ fi
vcsbranch+=$CVSTAG
- if [ -d .svn ]
- then
- # get svn status
- #
- __debug -n " SVN status..."
- SVNREV=$(LC_ALL=C svn info 2>&- $PWD | awk '/^Revision: / {print $2}')
- SVNREVSIZE=${#${SVNREV:+ r$SVNREV}}
- if [ "$SVNREV" != "" ]
- then
- if [ ! -z "$CHECK_SVN_STATUS" ]
- then
- SVNSTATUS="$(svn diff 2>&-)"
- SVNSTATUS=${${SVNSTATUS:+$_gcl_colors[changed]}:-$_gcl_colors[uptodate]}
- fi
- fi
- SVNREV=${SVNREV:+$C_$_prompt_colors[doubledot]$_C$C_$SVNSTATUS$_C"r"$SVNREV}
- __debug
- fi
+ if [ -d .svn ]
+ then
+ # get svn status
+ #
+ __debug -n " SVN status..."
+ SVNREV=$(LC_ALL=C svn info 2>&- $PWD | awk '/^Revision: / {print $2}')
+ SVNREVSIZE=${#${SVNREV:+ r$SVNREV}}
+ if [ "$SVNREV" != "" ]
+ then
+ if [ ! -z "$CHECK_SVN_STATUS" ]
+ then
+ SVNSTATUS="$(svn diff 2>&-)"
+ SVNSTATUS=${${SVNSTATUS:+$_gcl_colors[changed]}:-$_gcl_colors[uptodate]}
+ fi
+ fi
+ SVNREV=${SVNREV:+$C_$_prompt_colors[doubledot]$_C$C_$SVNSTATUS$_C"r"$SVNREV}
+ __debug
+ fi
[ -n "$SVNREV" ] && vcsbranch+=${vcsbranch:+ }$SVNREV
- # get hg status
- HGBRANCH=$(__get_gcl_branch hg)
+ # get hg status
+ HGBRANCH=$(__get_gcl_branch hg)
[ -n "$HGBRANCH" ] && vcsbranch+=${vcsbranch:+ }$HGBRANCH
- # get git status
- #
- GITBRANCH=$(__get_gcl_branch git)
- GITBRANCHSIZE=${#GITBRANCH}
- [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE))
+ # get git status
+ #
+ GITBRANCH=$(__get_gcl_branch git)
+ GITBRANCHSIZE=${#GITBRANCH}
+ [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE))
#
- #__debug -n " Path..."
- #PATHSIZE=$(print -Pn $CURDIR)
- #PATHSIZE=${#PATHSIZE}
- #__debug
- #__debug -n " Resize path / gitbranch..."
- #spaceleft=`__expand_text "%n@%m${DISPLAY:+($DISPLAY)} $ ls -laCdtrux $DATE"`
- #spaceleft=$(($COLUMNS - ${#spaceleft}))
- ##minimalpathsize=`print -Pn "../%1~"`
- ##minimalpathsize=${#minimalpathsize}
- #minimalpathsize=10
- #minimalgitsize=10 # git-abbrev-commit-ish...
- #if [ $GITBRANCHSIZE -gt 0 ]
- #then
- # if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ]
- # then
- # CHUNKABLE=${${GITBRANCH/*→/}/←*/}
+ #__debug -n " Path..."
+ #PATHSIZE=$(print -Pn $CURDIR)
+ #PATHSIZE=${#PATHSIZE}
+ #__debug
+ #__debug -n " Resize path / gitbranch..."
+ #spaceleft=`__expand_text "%n@%m${DISPLAY:+($DISPLAY)} $ ls -laCdtrux $DATE"`
+ #spaceleft=$(($COLUMNS - ${#spaceleft}))
+ ##minimalpathsize=`print -Pn "../%1~"`
+ ##minimalpathsize=${#minimalpathsize}
+ #minimalpathsize=10
+ #minimalgitsize=10 # git-abbrev-commit-ish...
+ #if [ $GITBRANCHSIZE -gt 0 ]
+ #then
+ # if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ]
+ # then
+ # CHUNKABLE=${${GITBRANCH/*→/}/←*/}
#
- # # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
- # if [ $GITBRANCHSIZE -gt $minimalgitsize ]
- # then
- # GITBRANCHCHUNK=$(( $GITBRANCHSIZE - ($spaceleft - $PATHSIZE) ))
- # [ $((${#CHUNKABLE} - $GITBRANCHCHUNK)) -lt $minimalgitsize ] && GITBRANCHCHUNK=$((${#CHUNKABLE} - $minimalgitsize))
- # fi
- # CHUNKABLE=`print -Pn "%"$(( ${#CHUNKABLE} - ${GITBRANCHCHUNK:-0} ))">¬>"${CHUNKABLE%\~*}`
+ # # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
+ # if [ $GITBRANCHSIZE -gt $minimalgitsize ]
+ # then
+ # GITBRANCHCHUNK=$(( $GITBRANCHSIZE - ($spaceleft - $PATHSIZE) ))
+ # [ $((${#CHUNKABLE} - $GITBRANCHCHUNK)) -lt $minimalgitsize ] && GITBRANCHCHUNK=$((${#CHUNKABLE} - $minimalgitsize))
+ # fi
+ # CHUNKABLE=`print -Pn "%"$(( ${#CHUNKABLE} - ${GITBRANCHCHUNK:-0} ))">¬>"${CHUNKABLE%\~*}`
#
- # GITBRANCH=${GITBRANCH/→*←/→$CHUNKABLE←}
- # fi
- #fi
+ # GITBRANCH=${GITBRANCH/→*←/→$CHUNKABLE←}
+ # fi
+ #fi
# then we reduce the path until it reaches the last path element,
- #spaceleft=$(($spaceleft - $GITBRANCHSIZE))
- #[ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize
- #__debug
+ #spaceleft=$(($spaceleft - $GITBRANCHSIZE))
+ #[ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize
+ #__debug
- if [ -n "$GITBRANCH" ]
- then
- GITBRANCH=$C_$_prompt_colors[soft_generic]$_C${${GITBRANCH/→/$C_"$(__get_git_status)"$_C}/←/$C_$_prompt_colors[soft_generic]$_C}"$(__get_guilt_series)$C_$color[none]$_C"
- fi
+ if [ -n "$GITBRANCH" ]
+ then
+ GITBRANCH=$C_$_prompt_colors[soft_generic]$_C${${GITBRANCH/→/$C_"$(__get_git_status)"$_C}/←/$C_$_prompt_colors[soft_generic]$_C}"$(__get_guilt_series)$C_$color[none]$_C"
+ fi
[ -n "$GITBRANCH" ] && vcsbranch+=${vcsbranch:+ }$GITBRANCH
- echo $vcsbranch
+ echo $vcsbranch
}
PS1_EXTRA_INFO+=(__vcsbranch)
__redefine_prompt ()
{
- case "$_yeahconsole" in
- "true")
- __yeah_prompt
- ;;
- *)
- __two_lines_prompt
- ;;
- esac
+ case "$_yeahconsole" in
+ "true")
+ __yeah_prompt
+ ;;
+ *)
+ __two_lines_prompt
+ ;;
+ esac
}
__yeah_prompt ()
@@ -314,43 +314,41 @@ __two_lines_prompt ()
ZSH_STATUS=$(__zsh_status)
if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" )
then
- __set_prompt_colors "38;5;54"
- echo
- echo -n $c_$_prompt_colors[warning]$_c
- #toilet -f bigmono9 "D1rTY Zsh.."
-
- HBAR=$(for i in {1..13} ; echo -n - "$_tq_")
- VBAR=$T_$_tx_$_T
-
- echo
- echo -n " "
- echo -n $T_$_tl_
- echo -n $HBAR
- echo -n $_tk_$_T
- echo
- echo " $VBAR WARNING !! $VBAR"
- echo " $VBAR D1rTY Zsh.. $VBAR"
-
- echo -n " "
- echo -n $T_$_tm_
- echo -n $HBAR
- echo -n $_tj_$_T
- echo
- echo $c_$_prompt_colors[none]$_c
+ __set_prompt_colors "38;5;54"
+ echo
+ echo -n $c_$_prompt_colors[warning]$_c
+ #toilet -f bigmono9 "D1rTY Zsh.."
+
+ HBAR=$(for i in {1..13} ; echo -n - "$_tq_")
+ VBAR=$T_$_tx_$_T
+
+ echo
+ echo -n " "
+ echo -n $T_$_tl_
+ echo -n $HBAR
+ echo -n $_tk_$_T
+ echo
+ echo " $VBAR WARNING !! $VBAR"
+ echo " $VBAR D1rTY Zsh.. $VBAR"
+
+ echo -n " "
+ echo -n $T_$_tm_
+ echo -n $HBAR
+ echo -n $_tj_$_T
+ echo
+ echo $c_$_prompt_colors[none]$_c
fi
precmd()
{
- # Catchs ERROR code
- ERROR=$(print -Pn "%(?;;%?)")
+ # Catchs ERROR code
+ ERROR=$(print -Pn "%(?;;%?)")
- __update_prompt_elements
- __redefine_prompt
+ __update_prompt_elements
+ __redefine_prompt
}
-# Prompt level 2
-PS2="$C_$color[yellow];$color[bold]$_C%_$C_$color[none];$color[cyan];$color[bold]$_C>$C_$color[none]$_C "
# Prompt level 3
PS3="?# "
diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh
index 6d8a5f4..c8df315 100644
--- a/user:hugues/KeyBindings.zsh
+++ b/user:hugues/KeyBindings.zsh
@@ -21,33 +21,33 @@ set_keymap()
# Vi-mode
set_keymap viins
-bindkey '[3~' delete-char # delete
-bindkey '[2~' overwrite-mode # insert
-bindkey '' up-line-or-history # up
-bindkey '' down-line-or-history # down
-bindkey '' history-search-backward # META-up
-bindkey '' history-search-forward # META-down
-bindkey '' forward-word # ESC right
-bindkey '' backward-word # ESC left
-bindkey '[3~' kill-region # ESC del
+bindkey '^[[3~' delete-char # delete
+bindkey '^[[2~' overwrite-mode # insert
+bindkey '^[[A' up-line-or-history # up
+bindkey '^[[B' down-line-or-history # down
+bindkey '^[^[[A' history-search-backward # META-up
+bindkey '^[^[[B' history-search-forward # META-down
+bindkey '^[^[[C' forward-word # ESC right
+bindkey '^[^[[D' backward-word # ESC left
+bindkey '^[^[[3~' kill-region # ESC del
test $TERM = 'rxvt' -o $TERM = 'xterm' -o $TERM = 'aterm' &&
{
- bindkey '[1~' beginning-of-line # home
- bindkey '[4~' end-of-line # end-of-line
- bindkey 'Oc' forward-word # CTRL right
- bindkey 'Od' backward-word # CTRL left
- bindkey '[3$' vi-set-buffer # SHIFT del
- bindkey 'Oa' history-search-backward # CTRL UP
- bindkey 'Ob' history-search-forward # CTRL DOWN
- bindkey 'OH' beginning-of-line # home
- bindkey 'OF' end-of-line # end-of-line
+ bindkey '^[[1~' beginning-of-line # home
+ bindkey '^[[4~' end-of-line # end-of-line
+ bindkey '^[Oc' forward-word # CTRL right
+ bindkey '^[Od' backward-word # CTRL left
+ bindkey '^[[3$' vi-set-buffer # SHIFT del
+ bindkey '^[Oa' history-search-backward # CTRL UP
+ bindkey '^[Ob' history-search-forward # CTRL DOWN
+ bindkey '^[OH' beginning-of-line # home
+ bindkey '^[OF' end-of-line # end-of-line
}
#
# Sanity
#
-bindkey '#' set-mark-command
+#bindkey '^X#' set-mark-command
bindkey '^A' beginning-of-line
bindkey '^B' backward-char
bindkey '^D' delete-char-or-list
@@ -79,7 +79,7 @@ bindkey '^X^O' overwrite-mode
bindkey '^X^R' _read_comp
bindkey '^X^U' undo
bindkey '^X^V' vi-cmd-mode
-bindkey '^X^X' exchange-point-and-mark
+#bindkey '^X^X' exchange-point-and-mark
bindkey '^X*' expand-word
bindkey '^X=' what-cursor-position
bindkey '^X?' _complete_debug
@@ -99,159 +99,159 @@ bindkey '^Xt' _complete_tag
bindkey '^Xu' undo
bindkey '^X~' _bash_list-choices
bindkey '^Y' yank
-bindkey '^D' list-choices
-bindkey '^G' send-break
-bindkey '^H' backward-kill-word
-bindkey '^I' self-insert-unmeta
-bindkey '^J' self-insert-unmeta
-bindkey '^L' clear-screen
-bindkey '^M' self-insert-unmeta
-bindkey '[3~' kill-region
-bindkey '' history-search-backward
-bindkey '' history-search-forward
-bindkey '' forward-word
-bindkey '' backward-word
-bindkey '^_' copy-prev-word
-bindkey ' ' magic-space
-bindkey '!' expand-history
-bindkey '\'' quote-region
-bindkey '\$' spell-word
-bindkey ''' quote-line #''
-bindkey ',' _history-complete-newer
-bindkey '-' neg-argument
-bindkey '.' insert-last-word
-bindkey '/' _history-complete-older
-bindkey '0' digit-argument
-bindkey '1' digit-argument
-bindkey '2' digit-argument
-bindkey '3' digit-argument
-bindkey '4' digit-argument
-bindkey '5' digit-argument
-bindkey '6' digit-argument
-bindkey '7' digit-argument
-bindkey '8' digit-argument
-bindkey '9' digit-argument
-bindkey '<' beginning-of-buffer-or-history
-bindkey '>' end-of-buffer-or-history
-bindkey '?' which-command
-bindkey 'A' accept-and-hold
-bindkey 'B' backward-word
-bindkey 'C' capitalize-word
-bindkey 'D' kill-word
-bindkey 'F' forward-word
-bindkey 'G' get-line
-bindkey 'H' run-help
-bindkey 'L' down-case-word
-bindkey 'N' history-search-forward
-bindkey 'OA' up-line-or-history
-bindkey 'OB' down-line-or-history
-bindkey 'OC' forward-char
-bindkey 'OD' backward-char
-bindkey 'P' history-search-backward
-bindkey 'Q' push-line
-bindkey 'S' spell-word
-bindkey 'T' transpose-words
-bindkey 'U' up-case-word
-bindkey 'W' copy-region-as-kill
-bindkey '[1~' beginning-of-line
-bindkey '[2~' overwrite-mode
-bindkey '[3~' delete-char
-bindkey '[4~' end-of-line
-bindkey '[5~' history-beginning-search-backward-end
-bindkey '[6~' history-beginning-search-forward-end
-bindkey '' up-line-or-history
-bindkey '' down-line-or-history
-bindkey '' forward-char
-bindkey '' backward-char
-bindkey '_' insert-last-word
-bindkey 'a' accept-and-hold
-bindkey 'b' backward-word
-bindkey 'c' capitalize-word
-bindkey 'd' kill-word
-bindkey 'f' forward-word
-bindkey 'g' get-line
-bindkey 'h' run-help
-bindkey 'l' down-case-word
-bindkey 'n' history-search-forward
-bindkey 'p' history-search-backward
-bindkey 'q' push-line
-bindkey 's' spell-word
-bindkey 't' transpose-words
-bindkey 'u' up-case-word
-bindkey 'w' copy-region-as-kill
-bindkey 'x' execute-named-cmd
-bindkey 'y' yank-pop
-bindkey 'z' execute-last-named-cmd
-bindkey '|' vi-goto-column
-bindkey '~' _bash_complete-word
-bindkey '^?' backward-kill-word
-bindkey '^\' up-history
-bindkey '^\' down-history
-bindkey '^\' forward-char
-bindkey '^\' backward-char
+bindkey '^[^D' list-choices
+bindkey '^[^G' send-break
+bindkey '^[^H' backward-kill-word
+bindkey '^[^I' self-insert-unmeta
+bindkey '^[^J' self-insert-unmeta
+bindkey '^[^L' clear-screen
+bindkey '^[^M' self-insert-unmeta
+bindkey '^[^[[3~' kill-region
+bindkey '^[^[[A' history-search-backward
+bindkey '^[^[[B' history-search-forward
+bindkey '^[^[[C' forward-word
+bindkey '^[^[[D' backward-word
+bindkey '^[^_' copy-prev-word
+bindkey '^[ ' magic-space
+bindkey '^[!' expand-history
+bindkey "^['" set-mark-command
+bindkey '^[$' spell-word
+bindkey '^["' exchange-point-and-mark
+bindkey '^[,' _history-complete-newer
+bindkey '^[-' neg-argument
+bindkey '^[.' insert-last-word
+bindkey '^[/' _history-complete-older
+bindkey '^[0' digit-argument
+bindkey '^[1' digit-argument
+bindkey '^[2' digit-argument
+bindkey '^[3' digit-argument
+bindkey '^[4' digit-argument
+bindkey '^[5' digit-argument
+bindkey '^[6' digit-argument
+bindkey '^[7' digit-argument
+bindkey '^[8' digit-argument
+bindkey '^[9' digit-argument
+bindkey '^[<' beginning-of-buffer-or-history
+bindkey '^[>' end-of-buffer-or-history
+bindkey '^[?' which-command
+bindkey '^[A' accept-and-hold
+bindkey '^[B' backward-word
+bindkey '^[C' capitalize-word
+bindkey '^[D' kill-word
+bindkey '^[F' forward-word
+bindkey '^[G' get-line
+bindkey '^[H' run-help
+bindkey '^[L' down-case-word
+bindkey '^[N' history-search-forward
+bindkey '^[OA' up-line-or-history
+bindkey '^[OB' down-line-or-history
+bindkey '^[OC' forward-char
+bindkey '^[OD' backward-char
+bindkey '^[P' history-search-backward
+bindkey '^[Q' push-line
+bindkey '^[S' spell-word
+bindkey '^[T' transpose-words
+bindkey '^[U' up-case-word
+bindkey '^[W' copy-region-as-kill
+bindkey '^[[1~' beginning-of-line
+bindkey '^[[2~' overwrite-mode
+bindkey '^[[3~' delete-char
+bindkey '^[[4~' end-of-line
+bindkey '^[[5~' history-beginning-search-backward-end
+bindkey '^[[6~' history-beginning-search-forward-end
+bindkey '^[[A' up-line-or-history
+bindkey '^[[B' down-line-or-history
+bindkey '^[[C' forward-char
+bindkey '^[[D' backward-char
+bindkey '^[_' insert-last-word
+bindkey '^[a' accept-and-hold
+bindkey '^[b' backward-word
+bindkey '^[c' capitalize-word
+bindkey '^[d' kill-word
+bindkey '^[f' forward-word
+bindkey '^[g' get-line
+bindkey '^[h' run-help
+bindkey '^[l' down-case-word
+bindkey '^[n' history-search-forward
+bindkey '^[p' history-search-backward
+bindkey '^[q' push-line
+bindkey '^[s' spell-word
+bindkey '^[t' transpose-words
+bindkey '^[u' up-case-word
+bindkey '^[w' copy-region-as-kill
+bindkey '^[x' execute-named-cmd
+bindkey '^[y' yank-pop
+bindkey '^[z' execute-last-named-cmd
+bindkey '^[|' vi-goto-column
+bindkey '^[~' _bash_complete-word
+bindkey '^[^?' backward-kill-word
+bindkey '^\^[[A' up-history
+bindkey '^\^[[B' down-history
+bindkey '^\^[[C' forward-char
+bindkey '^\^[[D' backward-char
bindkey '^_' undo
bindkey ' '-'~' self-insert
-bindkey '' backward-delete-char
-bindkey '\M-^@'-'\M-' self-insert
+bindkey '^?' backward-delete-char
+bindkey '\M-^@'-'\M-^?' self-insert
#
#
for keymap in viins vicmd emacs
do
- bindkey -M $keymap 'r' _rehash
+ bindkey -M $keymap '^[r' _rehash
if ( __cmd_exists when )
then
- bindkey -M $keymap -s 'w' 'Q when\n'
+ bindkey -M $keymap -s '^[w' '^[Q when\n'
fi
if ( __cmd_exists todo )
then
- bindkey -M $keymap -s 't' 'Q todo\n'
- bindkey -M $keymap -s 'T' 'Q todo all -c\n'
+ bindkey -M $keymap -s '^[t' '^[Q todo\n'
+ bindkey -M $keymap -s '^[T' '^[Q todo all -c\n'
fi
- bindkey -M $keymap -s 'c' 'Q ./configure\n'
- bindkey -M $keymap -s '©' 'Q !?configure\n'
+ bindkey -M $keymap -s '^[c' '^[Q ./configure\n'
+ bindkey -M $keymap -s '^[©' '^[Q !?configure\n'
- bindkey -M $keymap -s 'm' 'Q make\n'
- bindkey -M $keymap -s 'M' 'Q make\n'
+ 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 '^[l' '^[Q l\n'
- bindkey -M $keymap -s ' ' '\\ '
+ bindkey -M $keymap -s '^[ ' '\\ '
- bindkey -M $keymap -s 'g' 'Q git st .\n'
- bindkey -M $keymap -s 'G' 'Q git fetchall\n'
+ bindkey -M $keymap -s '^[g' '^[Q git st .\n'
+ bindkey -M $keymap -s '^[G' '^[Q git fetchall\n'
- bindkey -M $keymap -s 'S' 'Q sudo !!'
+ bindkey -M $keymap -s '^[S' '^[Q sudo !!'
- bindkey -M $keymap -s 'X' 'Q up_up ; exec zsh -l\n'
+ bindkey -M $keymap -s '^[X' '^[Q up_up ; exec zsh -l\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 -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-input
- bindkey -M $keymap 'Q' push-input
+ bindkey -M $keymap '^[q' push-input
+ bindkey -M $keymap '^[Q' push-input
- bindkey -M $keymap -s 'R' 'Q __clear\n'
- bindkey -M $keymap -s 'B' 'Q __clear $(tput lines)\n'
+ bindkey -M $keymap -s '^[R' '^[Q __clear\n'
+ bindkey -M $keymap -s '^[B' '^[Q __clear $(tput lines)\n'
done
# redefines push-line for vicmd
-bindkey -M vicmd -s 'q' 'iq'
-bindkey -M vicmd -s 'Q' 'iQ'
+bindkey -M vicmd -s '^[q' 'i^[q'
+bindkey -M vicmd -s '^[Q' 'i^[Q'
# 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'
+bindkey -M vicmd '^R' '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()