* Tip of the day: suspend-shell widget
@ 2004-09-23 10:44 Peter Stephenson
2004-09-24 12:04 ` zzapper
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2004-09-23 10:44 UTC (permalink / raw)
To: Zsh users list
I was rather to surprised to find the following zle widget works
seamlessly (at least with the latest version of zsh), but then I'm a
cynic. Save it as suspend-shell in your $fpath.
Sample use:
autoload suspend-shell
zle -N suspend-shell
bindkey '^z' suspend-shell
^z now suspends the shell in the middle of the line editor. When you
bring it back to the foreground, you are exactly where you left off
editing. Obviously this is useless if the shell is running directly
in a terminal window, but detecting that is quite hard.
Possibly worth adding to Functions/Zle?
# start of suspend-shell
# Suspend the shell in the middle of line editing.
# When you continue, it resumes exactly where you left off.
# Won't suspend a login shell unless you pass a numeric argument.
if (( ${NUMERIC:-0} )); then
# "builtin" is in case someone decides to call this function suspend
builtin suspend -f
else
if [[ -o login ]]; then
zle -M "Can't suspend login shell (use numeric argument)"
return 1
else
builtin suspend
fi
fi
zle redisplay
# end of suspend-shell
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Tip of the day: suspend-shell widget
2004-09-23 10:44 Tip of the day: suspend-shell widget Peter Stephenson
@ 2004-09-24 12:04 ` zzapper
2004-09-24 12:53 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: zzapper @ 2004-09-24 12:04 UTC (permalink / raw)
To: zsh-users
On Thu, 23 Sep 2004 11:44:26 +0100, wrote:
>I was rather to surprised to find the following zle widget works
>seamlessly (at least with the latest version of zsh), but then I'm a
>cynic. Save it as suspend-shell in your $fpath.
>
>Sample use:
>
>autoload suspend-shell
>zle -N suspend-shell
>bindkey '^z' suspend-shell
>
>^z now suspends the shell in the middle of the line editor. When you
>bring it back to the foreground, you are exactly where you left off
>editing. Obviously this is useless if the shell is running directly
>in a terminal window, but detecting that is quite hard.
>
>Possibly worth adding to Functions/Zle?
>
>
># start of suspend-shell
># Suspend the shell in the middle of line editing.
># When you continue, it resumes exactly where you left off.
># Won't suspend a login shell unless you pass a numeric argument.
>
>if (( ${NUMERIC:-0} )); then
> # "builtin" is in case someone decides to call this function suspend
> builtin suspend -f
>else
> if [[ -o login ]]; then
> zle -M "Can't suspend login shell (use numeric argument)"
> return 1
> else
> builtin suspend
> fi
>fi
>
>zle redisplay
># end of suspend-shell
Peter, Is this for the case you're typing a command and think, yikes I need to check something else?
Does it also apply to vi-mode?
zzapper (vim, cygwin, wiki & zsh)
--
vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"
http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Tip of the day: suspend-shell widget
2004-09-24 12:04 ` zzapper
@ 2004-09-24 12:53 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2004-09-24 12:53 UTC (permalink / raw)
To: zsh-users
zzapper wrote:
> Peter, Is this for the case you're typing a command and think, yikes I need t
> o check something else?
I actually use "suspend" most when I'm su'd to another user for a
specific task and need to get back to my usual account.
> Does it also apply to vi-mode?
It should work anywhere.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-09-24 12:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 10:44 Tip of the day: suspend-shell widget Peter Stephenson
2004-09-24 12:04 ` zzapper
2004-09-24 12:53 ` Peter Stephenson
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).