Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: default pipe
- X-seq: zsh-users 9163
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: default pipe
- Date: Mon, 25 Jul 2005 17:28:14 +0000
- In-reply-to: <20050725145737.GA903@os>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050725145737.GA903@os>
On Jul 25,  4:57pm, GoTaR wrote:
}
} Is it possible somehow to set default pipe command?
Well, it's possible *somehow* but ...
} $ ls | <enter>
This is syntactically incomplete, so zsh is going to print the PS2
prompt and wait for you to enter another command.  In most cases I
think this is what you'd want.
The only way to subvert this is to hack the accept-line ZLE widget:
function accept-pipe-as-terminator {
   setopt localoptions extendedglob
   if [[ "$BUFFER" = *\|[[:space:]]# ]]
   then
      # in 4.2.x and later, use BUFFER+=less
      BUFFER="$BUFFER less"
   fi
   zle .accept-line
}
zle -N accept-line accept-pipe-as-terminator
Messages sorted by:
Reverse Date,
Date,
Thread,
Author