From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21225 invoked by alias); 15 Feb 2011 19:00:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15806 Received: (qmail 18198 invoked from network); 15 Feb 2011 19:00:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.12 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Thorsten Kampe Subject: Re: Key bindings not working under screen Date: Tue, 15 Feb 2011 19:59:45 +0100 Message-ID: References: <110215074453.ZM31765@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: nat.scz.novell.com User-Agent: MicroPlanet-Gravity/3.0.4 * Bart Schaefer (Tue, 15 Feb 2011 07:44:53 -0800) > On Feb 15, 11:55am, Thorsten Kampe wrote: > } On systems where JED is not installed (-> DEFAULT_EDITOR=vim) I can > } observe this: > } > } % bindkey | wc -l > } 147 > } % bindkey | grep copy-prev-shell-word > } "^[-" copy-prev-shell-word > } % screen > } % bindkey | wc -l > } 131 > } % bindkey | grep copy-prev-shell-word > } % > } > } I've renamed my .screenrc but the issue remains. Interestingly it only > } happens when I set $EDITOR *and* $VISUAL in .zshrc, only under screen > } and only with zsh (not bash). > } > } Can someone shed some light about the connection between $EDITOR, > } $VISUAL, zsh and screen? > > Zsh attempts to initialize the ZLE mode based on VISUAL if it is set > and EDITOR if it VISUAL is not. If whichever of those is chosen looks > like a variant of "vi" then ZLE initializes with vi-style key bindings, > otherwise it initializes with emacs-style key bindings. > > Probably what's happening is that when you log in, VISUAL and EDITOR > are not set, and ZLE initializes in emacs mode. I actually setopt emacs and no_vi in my .zshrc (but before setting VISUAL and EDITOR). > When you then start screen, those variables are in the environment and > ZLE initializes in vi mode. > > I further suspect that some of your bindkey settings are always ending > up in the emacs keymap, even when ZLE is in vi mode. Have you tried > capturing the bindkey output in a file in each case and diffing them? "^I" complete-word -> expand-or-complete "^[-" copy-prev-shell-word -> neg-argument "^[O5C" forward-word [deleted] "^[O5D" backward-word [deleted] "^[Oc" forward-word [deleted] "^[Od" backward-word [deleted] "^[[1;5C" forward-word [deleted] "^[[1;5D" backward-word [deleted] "^[[1~" beginning-of-line [deleted] "^[[3~" delete-char [deleted] "^[[4~" end-of-line [deleted] "^[[7~" beginning-of-line [deleted] "^[[8~" end-of-line [deleted] "^[[A" history-beginning-search-backward -> up-line-or-history "^[[B" history-beginning-search-forward -> down-line-or-history "^[[F" end-of-line [deleted] "^[[H" beginning-of-line [deleted] "^[[a" up-line-or-beginning-search [deleted] "^[[b" down-line-or-beginning-search [deleted] "^[q" push-line-or-edit -> push-line " " global-alias-space [deleted] "!"-"~" self-insert -> " "-"~" self-insert As far as I can see, these are all from my .zshrc (the deleted ones and the ones before the "->"): ## bindkey '^i' complete-word bindkey '^[q' push-line-or-edit bindkey '^[-' copy-prev-shell-word bindkey '\e[3~' delete-char bindkey '\e[A' history-beginning-search-backward bindkey '\e[B' history-beginning-search-forward # xterm/rxvt ("od -c") # [Ctrl][V] bindkey '\eOd' backward-word # '^[Od' bindkey '\eOc' forward-word # '^[Oc' bindkey '\e[7~' beginning-of-line # '^[[7~' bindkey '\e[8~' end-of-line # '^[[8~' # Konsole bindkey '\e[1;5D' backward-word bindkey '\e[1;5C' forward-word bindkey '\e[H' beginning-of-line bindkey '\e[F' end-of-line # GNOME Terminal bindkey '\eO5D' backward-word bindkey '\eO5C' forward-word autoload up-line-or-beginning-search \ down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey '\e[a' up-line-or-beginning-search bindkey '\e[b' down-line-or-beginning-search # Cygwin and Linux Console return the same keycode for [Ctrl][Key], # shifted and unshifted bindkey '\e[1~' beginning-of-line bindkey '\e[4~' end-of-line # Bart Schaefer autoload -Uz match-words-by-style global-alias-space() { emulate -LR zsh match-words-by-style -w shell local ga=$matched_words[2] if [[ -n $ga ]]; then matched_words[2]="${${galiases[$ga]}:-$ga}" LBUFFER="${(j::)matched_words[1,3]}" fi zle .self-insert;} zle -N global-alias-space bindkey ' ' global-alias-space accept-line() { emulate -LR zsh match-words-by-style -w shell local ga=$matched_words[2] if [[ -n $ga && ( -n $matched_words[4] || -z $matched_words[5] ) ]]; then matched_words[2]="${${galiases[$ga]}:-$ga}" LBUFFER="${(j::)matched_words[1,3]}" fi zle .accept-line;} zle -N accept-line ## Thorsten