zsh-users
 help / color / mirror / code / Atom feed
* mapping ctrl-D to <ctrl-W ctrl-D>
@ 2009-11-18 12:22 Eric Smith
  2009-11-18 12:46 ` Peter Stephenson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Smith @ 2009-11-18 12:22 UTC (permalink / raw)
  To: Zsh Users

What is a nice clean way to do this mapping?
To absolutely close a shell even if spaces or words on this line.

Thanks 

-- 
- Eric Smith


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

* Re: mapping ctrl-D to <ctrl-W ctrl-D>
  2009-11-18 12:22 mapping ctrl-D to <ctrl-W ctrl-D> Eric Smith
@ 2009-11-18 12:46 ` Peter Stephenson
  2009-11-18 13:00 ` Atom Smasher
  2009-11-18 13:01 ` Atom Smasher
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2009-11-18 12:46 UTC (permalink / raw)
  Cc: Zsh Users

On Wed, 18 Nov 2009 13:22:41 +0100
Eric Smith <es@fruitcom.com> wrote:
> What is a nice clean way to do this mapping?
> To absolutely close a shell even if spaces or words on this line.

  clear-and-exit() {
    zle kill-whole-line
    exit
  }
  zle -N clear-and-exit

gives you a ZLE function you can bind a key to.  (I presume you don't
really need the exit to be generated by a ^D that looks like an
end-of-file.)  You don't actually need to delete the line first, although
it looks neater.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


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

* Re: mapping ctrl-D to <ctrl-W ctrl-D>
  2009-11-18 12:22 mapping ctrl-D to <ctrl-W ctrl-D> Eric Smith
  2009-11-18 12:46 ` Peter Stephenson
@ 2009-11-18 13:00 ` Atom Smasher
  2009-11-18 13:01 ` Atom Smasher
  2 siblings, 0 replies; 4+ messages in thread
From: Atom Smasher @ 2009-11-18 13:00 UTC (permalink / raw)
  To: Eric Smith; +Cc: Zsh Users

On Wed, 18 Nov 2009, Eric Smith wrote:

> What is a nice clean way to do this mapping? To absolutely close a shell 
> even if spaces or words on this line.
============

kill-it-all () {
 	zle && zle .kill-whole-line
 	exit
}
zle -N kill-it-all
bindkey '^D' kill-it-all


-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"States of war are also understood to require the opposition
 	 in the legislature to moderate its otherwise essential
 	 functions of criticism. Calls are issued to stand behind
 	 the political leadership and to display unity, with the
 	 implication that the enemy is watching and that failure to
 	 unite is tantamount to treason. These are not healthy
 	 conditions for a democracy; indeed, they are the opposite of
 	 democracy."
 		-- Philip E. Agre, Department of Information Studies,
 		University of California, Los Angeles


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

* Re: mapping ctrl-D to <ctrl-W ctrl-D>
  2009-11-18 12:22 mapping ctrl-D to <ctrl-W ctrl-D> Eric Smith
  2009-11-18 12:46 ` Peter Stephenson
  2009-11-18 13:00 ` Atom Smasher
@ 2009-11-18 13:01 ` Atom Smasher
  2 siblings, 0 replies; 4+ messages in thread
From: Atom Smasher @ 2009-11-18 13:01 UTC (permalink / raw)
  To: Eric Smith; +Cc: Zsh Users

On Wed, 18 Nov 2009, Eric Smith wrote:

> What is a nice clean way to do this mapping? To absolutely close a shell 
> even if spaces or words on this line.
=============

actually...

kill-it-all () {
 	exit
}
zle -N kill-it-all
bindkey '^D' kill-it-all



-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"There can be no greater good than the quest for peace,
 	 and no finer purpose than the preservation of freedom."
 		-- U.S. President Ronald Reagan


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

end of thread, other threads:[~2009-11-18 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18 12:22 mapping ctrl-D to <ctrl-W ctrl-D> Eric Smith
2009-11-18 12:46 ` Peter Stephenson
2009-11-18 13:00 ` Atom Smasher
2009-11-18 13:01 ` Atom Smasher

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