zsh-users
 help / color / mirror / code / Atom feed
* bindkey -s question
@ 1998-04-18  5:51 Danek Duvall
  1998-04-18 10:11 ` TGAPE!
  0 siblings, 1 reply; 5+ messages in thread
From: Danek Duvall @ 1998-04-18  5:51 UTC (permalink / raw)
  To: Zsh Users

I'm trying to bind ^L to a key sequence that will reset my xterm saved
lines.  The escape sequence ^[c does the trick if I do

    echo -n ^[c

at the command line.  However, if I try

    bindkey -s "^L" "echo -n ^[c"

it just prints a new prompt as if I'd typed return.  (Note I've typed all
the control charaters using ^V first; I'm just typing them safely here.)

I managed to get somewhat the behavior I want by

    zle -N clear-screen2
    function clear-screen2 () { echo -n ^[c; zle clear-screen }
    bindkey "^L" clear-screen2

Without the call to clear-screen, the prompt doesn't get printed, but with
it there's a slight flash.

I'm using xterm-70, if that makes any difference.

How should I be going about this?

Danek


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bindkey -s question
  1998-04-18  5:51 bindkey -s question Danek Duvall
@ 1998-04-18 10:11 ` TGAPE!
  1998-04-18 15:42   ` Danek Duvall
  0 siblings, 1 reply; 5+ messages in thread
From: TGAPE! @ 1998-04-18 10:11 UTC (permalink / raw)
  To: Danek Duvall; +Cc: zsh-users

Danek Duvall wrote:
> 
> I'm trying to bind ^L to a key sequence that will reset my xterm saved
> lines.  The escape sequence ^[c does the trick if I do
> 
>     echo -n ^[c
> 
> at the command line.  However, if I try
> 
>     bindkey -s "^L" "echo -n ^[c"
> 
> it just prints a new prompt as if I'd typed return.  (Note I've typed all
> the control charaters using ^V first; I'm just typing them safely here.)
                              ^^
Right here's your key - -s puts the keys on the line as if you typed
them.  Try typing 'echo -n ^[c' on the command line and see what
happens.  Anyway, I think 'echo -n ^V^O' is what you really want; you
then don't need to associate it with clear-screen.

> I managed to get somewhat the behavior I want by
> 
>     zle -N clear-screen2
>     function clear-screen2 () { echo -n ^[c; zle clear-screen }
>     bindkey "^L" clear-screen2
> 
> Without the call to clear-screen, the prompt doesn't get printed, but with
> it there's a slight flash.

Which tells you what would happen with what you're trying with the
bindkey you're asking about - you'd get no prompt.

I handle this with
alias sanity='echo ^O; stty sane; stty -erase ^H'

I avoid the situation enough that a keybinding is not called for.
Considering the number of actual terminal lockups available from the
same source as your messed up charset, I think avoidance is probably a
good idea.  (I saw one of those happen to a sysadmin at work, who was on
console on a machine which must not go down.  Oops.  Funny thing was, he
didn't realize it was a binary file until I showed it to him with less.
And some people wonder why I hate /bin/more with a passion.)

> I'm using xterm-70, if that makes any difference.

It does - it means you're talking about a dec-vt style terminal, which
is what I know best.  You'll only have problems applying this to
something weird like wyse terminals (what the hey?!?) or ansi
(standards?  Who ever follows standards?) (though dec-vt style is close
enough to ansi that it might carry over.)

Ed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bindkey -s question
  1998-04-18 10:11 ` TGAPE!
@ 1998-04-18 15:42   ` Danek Duvall
  0 siblings, 0 replies; 5+ messages in thread
From: Danek Duvall @ 1998-04-18 15:42 UTC (permalink / raw)
  To: Zsh Users

On Sat, Apr 18, 1998 at 10:11:54AM +0000, TGAPE! wrote:

> Right here's your key - -s puts the keys on the line as if you typed
> them.  Try typing 'echo -n ^[c' on the command line and see what
> happens.

D'Oh!  It completely slipped my mind that I would have to include the ^V in
the bindkey out-string, too.  That completely solves the problem; my saved
lines are reset, the screen is cleared, and I get a prompt printed (which
was what I wanted ... not to reset to a G0 charset and sane tty, though it
probably wouldn't hurt to throw that in anyway :).

I'm still not sure I see what's going on WRT the widget solution.  It,
after all, should do the echo exactly like I want.  I tried putting the
echo in a function and binding ^L to call that function, and that worked
fine, so I don't see why it doesn't work in a widget, unless I explicitly
have to tell zsh to print a prompt afterwards.

Anyway, thanks much.  That should teach me not to try to learn new things
on so little sleep.  ;-)

Danek


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bindkey -s question
  1998-04-25 13:55 Mirar
@ 1998-04-27  8:47 ` Andrew Main
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Main @ 1998-04-27  8:47 UTC (permalink / raw)
  To: Mirar; +Cc: zsh-users

Mirar wrote:
>I would like a prompt, with parts that only shows when i'm editing the
>command, like the mode line in emacs. Is this possible to have in zsh
>without heavy modification of the source?

No.  Not yet.

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bindkey -s question
@ 1998-04-25 13:55 Mirar
  1998-04-27  8:47 ` Andrew Main
  0 siblings, 1 reply; 5+ messages in thread
From: Mirar @ 1998-04-25 13:55 UTC (permalink / raw)
  To: Zsh Users


I would like a prompt, with parts that only shows when i'm editing the
command, like the mode line in emacs. Is this possible to have in zsh
without heavy modification of the source?

								 |
|.								 |
|.								 |
|.								 |
|mistel% echo $PWD                                               |
|/home/mirar                                                     |
|mistel% last | head -2                                          |
|per   ttyp9     194.52.182.48  Thu Apr 23 14:38 - 16:20  (01:42)|
|js    ttyq2     194.52.182.50  Mon Apr 20 19:50 - 23:00  (03:10)|
|mistel% ps | grep washuu                                        |
| 1540  p2 S    4:56 pike xwashuu.pike                           |
| 5706  p1 D    0:00 grep washuu                                 |
|mistel% cat /proc/meminfo | wc                                  |
|     10      38     319                                         |
|--**-zsh: mistel: ~/ ------------------------(Cmd)--14:01--L12--|
|% _								 |
+----------------------------------------------------------------+


/Mirar

__________________________________________________________________________
Idonex AB               Telefon      Telefax      nalle
Skolgatan 10		013-376814   013-376801   0708-376867
582 35 Linköping        mirar@idonex.se           http://www.idonex.se/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-04-27  8:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-18  5:51 bindkey -s question Danek Duvall
1998-04-18 10:11 ` TGAPE!
1998-04-18 15:42   ` Danek Duvall
1998-04-25 13:55 Mirar
1998-04-27  8:47 ` Andrew Main

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).