From f6b85812cd7cde549ad8c919d5d3ba45269f8e1d Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 4 Feb 2009 08:27:22 +0100 Subject: [KeyBindings] vi-cmd mode by default --- user:hugues/KeyBindings.zsh | 202 ++++---------------------------------------- 1 file changed, 17 insertions(+), 185 deletions(-) (limited to 'user:hugues/KeyBindings.zsh') diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh index 0be36e9..b06844d 100644 --- a/user:hugues/KeyBindings.zsh +++ b/user:hugues/KeyBindings.zsh @@ -23,10 +23,6 @@ bindkey '' forward-word # ESC right bindkey '' backward-word # ESC left bindkey '[3~' kill-region # ESC del -# Pratique pour rehasher rapidement -bindkey -s 'r' 'Q rehash\n' -bindkey -s 'R' 'Q reset\n' - test $TERM = 'rxvt' -o $TERM = 'xterm' -o $TERM = 'aterm' && { bindkey '[1~' beginning-of-line # home @@ -43,186 +39,22 @@ test $TERM = 'xterm' && bindkey 'OH' beginning-of-line # home bindkey 'OF' end-of-line # end-of-line } -#bindkey '\C-t' gosmacs-transpose-chars # J, ca c'est un truc pour toi -# ne pas oublier de s'en servir : -# vi-match-bracket est sur ^X^B par defaut -# npo : quote-region est sur ESC-' par defaut -# npo : which-command est sur ESC-? par defaut -# Lancez ``bindkey'' pour en savoir plus !! - -#!/bin/zsh - -## Résultat d'un ``bindkey'' - -bindkey '#' set-mark-command -bindkey '^A' beginning-of-line -bindkey '^B' backward-char -bindkey '^D' delete-char-or-list -bindkey '^E' end-of-line -bindkey '^F' forward-char -bindkey '^G' send-break -bindkey '^H' backward-delete-char -bindkey '^I' expand-or-complete -bindkey '^J' accept-line -bindkey '^K' kill-line -bindkey '^L' clear-screen -bindkey '^M' accept-line -bindkey '^N' down-line-or-history -bindkey '^O' accept-line-and-down-history -bindkey '^P' up-line-or-history -bindkey '^Q' push-line -bindkey '^R' history-incremental-search-backward -bindkey '^S' history-incremental-search-forward -bindkey '^T' transpose-chars -bindkey '^U' kill-whole-line -bindkey '^V' quoted-insert -bindkey '^W' backward-kill-word -bindkey '^X^B' vi-match-bracket -bindkey '^X^F' vi-find-next-char -bindkey '^X^J' vi-join -bindkey '^X^K' kill-buffer -bindkey '^X^N' infer-next-history -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*' expand-word -bindkey '^X=' what-cursor-position -bindkey '^X?' _complete_debug -bindkey '^XC' _correct_filename -bindkey '^XG' list-expand -bindkey '^Xa' _expand_alias -bindkey '^Xc' _correct_word -bindkey '^Xd' _list_expansions -bindkey '^Xe' _expand_word -bindkey '^Xg' list-expand -bindkey '^Xh' _complete_help -bindkey '^Xm' _most_recent_file -bindkey '^Xn' _next_tags -bindkey '^Xr' history-incremental-search-backward -bindkey '^Xs' history-incremental-search-forward -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 '^_' undo -bindkey ' '-'~' self-insert -bindkey '' backward-delete-char -bindkey '\M-^@'-'\M-' self-insert - -# Raccourcis pour les todo : funny :) -# 'q' stands for 'push-line' -bindkey -s 't' 'Q todo\n' -#bindkey -s 'T' 'Q todo all -c\n' - -bindkey -s 'é' ' 2>/dev/null ' -bindkey -s '2' ' 2>&1 ' -bindkey -s 'm' 'Q make\n' -bindkey -s 'M' 'Q make\n' - -bindkey -s 'l' 'Q l\n' -#bindkey -s 'L' 'Q la\n' - -bindkey -s ' ' '\\ ' - -bindkey -s 'g' 'Q git-status\n' -bindkey -s 'G' 'Q git-repack -d -a\n' - -bindkey -s 'S' 'Q sudo !!' - -bindkey -s 'X' 'Q exec zsh\n' +# +# 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. -# conflicts with "lowercase word" -#bindkey -s 'L' 'Q clear\n' -- cgit v1.2.3 From 0918a251365c0ba831a085d2a2786c11eaa102b1 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 4 Feb 2009 08:52:05 +0100 Subject: [KeyBindings] shows current keymap used into the term title --- user:hugues/KeyBindings.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'user:hugues/KeyBindings.zsh') diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh index b06844d..5666dc3 100644 --- a/user:hugues/KeyBindings.zsh +++ b/user:hugues/KeyBindings.zsh @@ -58,3 +58,14 @@ zle-line-init() { zle vi-cmd-mode } zle -N zle-line-init # Go see man zshzle for more details. +zle-keymap-select() +{ + # $1 is the old keymap + # $KEYMAP is the new one + + local curr="$([ "$KEYMAP" = "main" ] && echo "viins" || echo $KEYMAP)" + + term_title " [$curr]" + +} +zle -N zle-keymap-select -- cgit v1.2.3