9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] command history
@ 2000-07-14 19:44 Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2000-07-14 19:44 UTC (permalink / raw)
  To: 9fans, sharris

It really is called ".  

I posted it yesterday.  If you wait a couple
hours it will probably come by again, now
that the echo is back.
I'll send you a copy separately though.

The " is, I believe, a reference to the common
shorthand meaning ``same as line above''.

Russ



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] command history
  2000-07-14 21:37 Russ Cox
@ 2000-07-14 23:24 ` Richard
  0 siblings, 0 replies; 6+ messages in thread
From: Richard @ 2000-07-14 23:24 UTC (permalink / raw)
  To: 9fans

I wrote:

>	it also has a bunch of affordances --delete_word and such-- for editing
>	a command line --a task that in the Plan 9 style is done with a mouse
>	and Rio.

Russ Cox writes:

>^w will delete the current word,
>in the editors and in rio.  and ^u
>the current line.

good point.  so let me clarify.  ile recognized the following commands,
some of which are not in the Plan 9 style because they do things the
mouse can easily do, like move the cursor.

what is slightly Plan 9ish about ile is that it "sits between"
the terminal emulator and the shell (or any other cooked-mode program).
this got me thinking that a Plan-9 port of ile could sit between
a rio window and rc (or any other line-at-a-time program).  just
a suggestion.

            ^B      - backward_char
            ^E      - end_of_line
            ^F      - forward_char
            ^K      - erase_to_end_of_line
            ^L      - retype_line
            ^N      - forward_history
            ^P      - backward_history
            ^R      - search_backward_history
            ^V      - quote
            ^T      - transpose_chars
            del     - delete_char
            ^M      - add_to_history
            ^J      - add_to_history
            ^U      - erase_line
            ^X      - delete_char_under

            esc b   - backward_word
            esc f   - forward_word
            esc del - delete_word
            esc esc - complete_file
            esc s   - complete_file_full
            esc p   - query_path
            esc d   - show_files
            esc u   - upper_word
            esc l   - lower_word
            esc c   - capitalize_word

            esc [ A - backward_history (up arrow)
            esc [ B - forward_history  (down arrow)
            esc [ C - forward_char     (right arrow)
            esc [ D - backward_char    (left arrow)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] command history
@ 2000-07-14 21:37 Russ Cox
  2000-07-14 23:24 ` Richard
  0 siblings, 1 reply; 6+ messages in thread
From: Russ Cox @ 2000-07-14 21:37 UTC (permalink / raw)
  To: 9fans

	it also has a bunch of affordances --delete_word and such-- for editing
	a command line --a task that in the Plan 9 style is done with a mouse
	and Rio.

^w will delete the current word,
in the editors and in rio.  and ^u
the current line.  be careful though:
^w deletes the current _window_
in microsoft-land, which is bad news
once your fingers get trained.

some people said they didn't get this
yesterday, so since i'm talking...

g% cat /usr/rsc/bin/rc/"
#!/bin/rc

{
	if(test -r /mnt/acme/acme/body)
		cat /mnt/acme/acme/body
	if not
		cat /dev/text
} | grep '^[^ 	]*%[ 	]*'$1  |
	{echo; cat} | pr -t -n | sort -u +1 | sort -n |
	sed 's/^ *[0-9]+	//' | grep .

# the silly {echo; cat} gets around pr printing "empty file" when
# presented with no input.
g%

for example:

g% " mk
>>> g% mk
>>> g% mk test
g%

shows the commands i've run in this window
that begin with "mk", ripe for editing or resending.

(except the >>>'s don't get printed in real life).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] command history
  2000-07-14 21:03 ` Richard Uhtenwoldt
@ 2000-07-14 21:25   ` Richard Uhtenwoldt
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Uhtenwoldt @ 2000-07-14 21:25 UTC (permalink / raw)
  To: 9fans

I just wrote:

>                       instead of rio invoking "rc", rio could invoke
>"ile;rc" where the only effect of the ile command is to bind /dev/cons
>to a fileserver which stores the commandline history and interprets the
>history-editing commands.  that way, no modification to rc or rio would
>be needed: ile would "sit between" rio and rc.

ignore this.  when I wrote this I did not consider that rio sends whole
lines to rc, not individual keystrokes.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] command history
  2000-07-14 14:16 Stephen C. Harris
@ 2000-07-14 21:03 ` Richard Uhtenwoldt
  2000-07-14 21:25   ` Richard Uhtenwoldt
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Uhtenwoldt @ 2000-07-14 21:03 UTC (permalink / raw)
  To: 9fans

Stephen C. Harris writes:
>Anthony Sorace <anothy@eden.rutgers.edu> wrote:
>> //is it possible to use history and command completion with rc?
>>  
>> no. rc has neither of these functions. history is the job of the 
>> windowing system - simply snarf your previous commands, edit in 
>> place, send them down... it's much better than the history built 
>> into most shells
>
>Except if there's a lot of output, or you want to go back more than one
>command, it's sometimes hard to find your previous command in the first 
>place.

I'm a Plan 9 newbie, but in case no one else has any other suggestions
I thought I'd mention ILE, which I learned of on the rc mailing list.

ile lets you scroll line by line up and down the commandline history and
also to search backwards through the history.  on a user-interface note,
the search command is modeless; in contrast, bash's search command (^s)
is modal.

ile has filename completion (it looks at Linux /proc to determine
the shell's cwd), but of course we know that the Plan 9 way is not
filename completion but rather, e.g., to get the name of the file in an
Acme window where you can click on it with button 3 of the mouse.

it also has a bunch of affordances --delete_word and such-- for editing
a command line --a task that in the Plan 9 style is done with a mouse
and Rio.

on Linux, ile uses a pty.  on Plan 9, ILE could modify the /dev/cons
that rc sees.  i.e., instead of rio invoking "rc", rio could invoke
"ile;rc" where the only effect of the ile command is to bind /dev/cons
to a fileserver which stores the commandline history and interprets the
history-editing commands.  that way, no modification to rc or rio would
be needed: ile would "sit between" rio and rc.

from the readme of "ile-linux.tgz":

README FOR LINUX VERSION OF ile -- INPUT LINE EDITOR

This is a port/enhancement of Rob Pendelton's ILE pty front end to
the Linux OS.  I myself mostly use it for 'rc' -- the unix port of the
USL plan 9 shell -- because it has no builtin line editing, and for
ash the excellent enhanced /bin/sh clone which also has no line editing.
I used to use it for 'ftp', but then I got ncftp.  I've found it to work
more reliably than 'atty' another popular front end, though its source code
is probably less modular.  It is nearly seven years old (much older than Linux
itself in fact ;-) but it works with Linux' pty's.  I have a lot of ideas
for enhancements, but I don't know if I'll get around to them.  I call this
the Linux version because it uses /proc/*/cwd for filename completions which
is *much* cleaner than any other pty-front end has at present.  (They mostly
use generous assumptions that the underlying process is a shell and prints out
prompts and can send codes in the prompts saying what the directory is, etc.)

                                                Charles Blake, 07/28/1994




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] command history
@ 2000-07-14 14:16 Stephen C. Harris
  2000-07-14 21:03 ` Richard Uhtenwoldt
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen C. Harris @ 2000-07-14 14:16 UTC (permalink / raw)
  To: 9fans

Anthony Sorace <anothy@eden.rutgers.edu> wrote:
> //is it possible to use history and command completion with rc?
>  
> no. rc has neither of these functions. history is the job of the 
> windowing system - simply snarf your previous commands, edit in 
> place, send them down... it's much better than the history built 
> into most shells

Except if there's a lot of output, or you want to go back more than one
command, it's sometimes hard to find your previous command in the first 
place.

As for snarfing commands before sending, that doesn't work if you 
want to go back several commands.  And I usually don't know I need to 
redo a command until I see something weird later in its output or 
elsewhere.

What about having a keystroke or something which just scrolls rc's window
back and positions the cursor exactly on the previous command ?  Hit it
multiple times and scroll back to earlier commands.  Then you could edit
them in place and send them just as before.  I had been thinking I might 
try it as a way of learning rio.

Or is there some way of doing something similar already?

ciao,

- Steve Harris



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-07-14 23:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-14 19:44 [9fans] command history Russ Cox
  -- strict thread matches above, loose matches on Subject: below --
2000-07-14 21:37 Russ Cox
2000-07-14 23:24 ` Richard
2000-07-14 14:16 Stephen C. Harris
2000-07-14 21:03 ` Richard Uhtenwoldt
2000-07-14 21:25   ` Richard Uhtenwoldt

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).