Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle clear-screen, exit status
- X-seq: zsh-users 15462
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: zle clear-screen, exit status
- Date: Tue, 19 Oct 2010 09:35:56 -0700
- In-reply-to: <20101019153258.GD2149@xxxxxxxxxxxxxxx>
- In-reply-to: <20101019155310.GE2149@xxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20101019153258.GD2149@xxxxxxxxxxxxxxx> <AANLkTinvgTGC7+dKKCR17vzmCxufy7zPDeaL=oFOzZj+@xxxxxxxxxxxxxx> <20101019155310.GE2149@xxxxxxxxxxxxxxx>
On Oct 19, 11:32am, Brian Lewis wrote:
}
} My prompt displays $?, the program exit status. When I hit Ctrl-L, I'd
} like $? to be set to 0 somehow before the prompt is redisplayed.
}
} I can't figure out how to do it. It is as if $? is saved before my
} widget is called, and restored after.
Yes, that's intentional. Under normal circumstances the editor should
behave entirely independently of the input command stream.
On Oct 19, 11:53am, Brian Lewis wrote:
}
} On Tuesday, 19.10.10 at 17:47, Jérémie Roquet wrote:
} > bindkey -s "^L" "clear\n"
} > is enough :)
}
} That's not quite as good as zle clear-screen:
}
} $ asdf^Lclear
} zsh: command not found: asdfclear
This should almost do it:
function clear2 { zle -U $'clear\n'; zle push-line-or-edit }
zle -N clear2
bindkey '^L' clear2
Where that fails is for a multi-line buffer (i.e., you're at the PS2
prompt or deeper). In that case push-line-or-edit simply moves up to
the PS1 prompt and the "zle -U" input is discarded, so you'll have to
press ^L a second time.
Optional tweak to avoid having "clear" in the shell history:
setopt hist_ignore_space
function clear2 { zle -U $' clear\n'; zle push-line-or-edit }
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author