From: Thorsten Kampe <thorsten@thorstenkampe.de>
To: zsh-users@zsh.org
Subject: Re: Key bindings not working under screen
Date: Tue, 15 Feb 2011 19:59:45 +0100 [thread overview]
Message-ID: <ijeif5$5vt$2@dough.gmane.org> (raw)
In-Reply-To: <110215074453.ZM31765@torch.brasslantern.com>
* 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
next prev parent reply other threads:[~2011-02-15 19:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 10:55 Thorsten Kampe
2011-02-15 11:16 ` Thorsten Kampe
2011-02-15 15:49 ` Bart Schaefer
2011-02-15 18:19 ` Thorsten Kampe
2011-02-15 15:44 ` Bart Schaefer
2011-02-15 18:59 ` Thorsten Kampe [this message]
2011-02-16 3:51 ` Bart Schaefer
2011-02-16 11:41 ` Thorsten Kampe
2011-02-16 17:01 ` Bart Schaefer
2011-02-25 16:56 ` Thorsten Kampe
2011-02-26 20:09 ` Hemant Borole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='ijeif5$5vt$2@dough.gmane.org' \
--to=thorsten@thorstenkampe.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).