bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: squeezing blanks out of command lines


From: Stephane Chazelas
Subject: Re: squeezing blanks out of command lines
Date: Sun, 30 Jan 2005 09:57:17 +0000
User-agent: slrn/0.9.8.1 (Debian)

2005-01-30, 04:05(+08), Dan Jacobson:
> The challenge: at the prompt take a line like
> $ this   is          a long        line  with lots of    space
> and turn it into
> $ this is a long line with lots of space
>
> With GNU emacs, a mere M-h M-q does the job.  But I bet bash is helpless
> here.
[...]

Strange requirement, but with zsh, you could do:

squeeze-blanks() {
  setopt localoptions extendedglob
  local a=${LBUFFER//[$' \t']##/ }
  BUFFER=${BUFFER//[$' \t']##/ }
  CURSOR=${#a}
}

zle -N squeeze-blanks

bindkey '^[q' squeeze-blanks

to have "M-q" squeeze blanks.

-- 
St├ęphane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]