Text editor as shell

The text editor interface I talked about yesterday is so good I find myself wanting to use for things other than text editing. In particular, I'd love to be able to use it as my command line interface. Most command line shells are annoying because you can't use the keyboard to move the cursor up into a program's output to copy it - you generally have to resort to the mouse. I think it would be far better to treat the entire command-line session as a document. One way to do this would be to have a text editor with a special key combination (say Ctrl+Enter) which takes the contents of the current line, executes it as a command, and pastes the resulting output into the document immediately below, followed by a prompt, followed by the cursor.

One useful aspect of command line interfaces is tab completion - it would be nice if there were a way to make this continue to work in the editor interface. Perhaps tab could be interpreted to mean "tab completion" if the line above the cursor was a prompt (maybe prompt lines are "special" in some way, though that counteracts the principle that there should be no "hidden" information). If prompt lines are special, then maybe pressing Enter on the line below would suffice for running commands, instead of a special key combination for this.

A variation on this idea would be to allow editing of multiple files in a single buffer. Suppose you're using the editor interface and "cat" (Unix) or "type" (Windows) the contents of a file, causing it to be inserted into the buffer. I think it would be tremendously useful if that file was then "live" and could be edited by just moving the cursor up into its contents, changing things, and then hitting some other key (perhaps Alt+S?) to save it. Again this goes against the "no hidden information" principle, though. Perhaps one of the ASCII control codes that aren't usually found in text files could be repurposed to have special meaning to the editor, to signify a line that is a prompt or contains the path to an embedded file.

2 Responses to “Text editor as shell”

  1. Jim Leonard says:

    "Text editor as shell" = emacs :-)

    • Andrew says:

      True, and in fact I think emacs can do exactly this (though I don't know of anyone who uses it as their primary shell). I use emacs at work, but I prefer TSE for most things.

Leave a Reply