Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: mapping ctrl-D to <ctrl-W ctrl-D>



On Wed, 18 Nov 2009 13:22:41 +0100
Eric Smith <es@xxxxxxxxxxxx> 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@xxxxxxx>            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



Messages sorted by: Reverse Date, Date, Thread, Author