blob: b7e3c3f4dcbb0640eeb481531e045cfc24dee123 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
Date: Mon, 7 Apr 2003 02:01:59 +0000 (UTC)
From: Miciah Dashiel Butler Masters <gcgs-gnu-screen@m.gmane.org>
Subject: Re: HOWTO: emulate vim's :help in a screen window
In article <20030406193514.4b43c6ba.mramos@adinet.com.uy>, Marcelo Ramos wrote:
> Something interesting and useful developed with Miciah's help a few minutes
> ago in the #screen channel (irc.debian.org):
>
> 1) Create a shell script "showman":
>
> echo -n "What manpage?"; read X; man $X; screen -X eval 'focus bottom' remove
>
> 2) Put the following in your.screenrc:
>
> bindkey "^B" eval split "focus bottom" "screen /path/to/showman"
>
> 3) Now press ^B and enjoy :-)
>
> (^B or the key you prefer)
You inspired to write a couple of scripts to generalise this process:
screen-run-program-in-region:
#!/bin/sh
eval "$*"
echo -n Press any key to close this region...
read throwaway_variable
screen -X eval 'focus bottom' remove
screen-open-region-with-program:
#!/bin/sh
screen -X eval \
"focus bottom" \
split \
"focus bottom" \
"screen screen-run-program-in-region $*"
Note that enabling zombie-mode will interfere with this script's
operation -- to kill the zombie window, screen-run-program-in-region
would need to also send Screen the 'kill' command. Unfortunately, if you
_disable_ zombie-mode then the 'kill' command would probably kill a
program that you _don't_ want killed. This is why we need a per-window
zombie-setting (*nudge* *nudge*). A way to silence the kill command
would also be nice.
BTW, I know that 'echo -n' is not portable. Please forgive me. You can
feel free to remove the '-n'.
-- Miciah <miciah@myrealbox.com>
|