Features I want in my terminal emulator
- Each individual command writes its output into its own fixed-size, scrollable, collapsible, searchable pane.
- Highlight a command invocation or output in red if the command exited with a non-zero exit code.
- (VS Code's integrated terminal does this.)
- Option to show standard output and standard error split into separate panes.
- After a command finishes, print how long it ran for.
- Show timestamp of when command started and finished (for commands that take longer than X seconds).
- Show live memory and CPU usage of a running command.
- Let me run a command while another is executing (or queue it up to run once the previous command succeeded).
- If I use the arrow keys to select previous commands, I only want to see commands in the current session. But if I search for a command with Ctrl+R, I want to see all commands in my history, including commands run in other currently-open terminals.
- (This is actually in a shell feature.)
- It shouldn't be possible for me to type into a command's output window unless the command is actively accepting input.
- Run
sleep 5
in a Unix shell and then immediately typeabc
and hit 'Enter'. In Bash and Zsh this causesabc
to be run as a command whensleep
returns. How does this make sense?
- Run
Every command runs in its own mini pseudo-terminal so that ANSI control codes and full-blown TUIs still work.
Some ideas that wouldn't be compatible with existing programs, in ascending order of craziness:
- A proper API for controlling the terminal UI, instead of in-band control binary codes.
- Modal input dialogs?
- Support for non-text files. Why can't I view an image or a PDF in my terminal?
- iTerm2 can in fact do this, but it doesn't work very well –
imgcat
hangs for me on a 6 MB file.
- iTerm2 can in fact do this, but it doesn't work very well –
- Structured output:
ls -l
returns a list of structs, if printed directly to terminal then formatted as a table, but if piped to another command then passed unchanged- No need for every command to implement its own output format.
- No need for
-z
andxargs
.
- Unify all custom REPLs into the shell. Why can't I do
!psql !(py build_sql_query())
? - Parse command line flags in the shell instead of re-implementing it in every programming language.
cmd -verbose -output /dev/null a b c
should pass something like["a", "b", "c"], { verbose: true, output: "/dev/null" }
, tocmd
.- Each command would need to declare its expected arguments (otherwise, the generic parser wouldn't know in the example above if
/dev/null
was an argument of-output
or a standalone positional argument.) - Then,
help cmd
could automatically be implemented for all commands by the shell. - This would also require some way to start a program with structured arguments instead of the flat list of byte-strings that
exec
on Linux takes.
- Each command would need to declare its expected arguments (otherwise, the generic parser wouldn't know in the example above if
- No distinction between binaries and libraries. Install
libcurl
, then runh := /lib/curl/easy_init && /lib/curl/easy_perform $h
.- Idea: Core ABI that defines a basic set of atomic and structured types (integers, strings, lists, records, etc.). "Native" applications use the core ABI, while programs written in other languages translate with a shim. Type-checking at runtime. This fits naturally with the structured output and command-line parsing ideas – they can all use the same set of basic types and the same ABI!
UI mock-up
(Courtesy of ChatGPT)
user@host:~$ ls -l
⏱ 0.004s | 🕓 10:32:01
-rw-r--r-- 1 user user 1234 Jul 19 file1.txt
-rw-r--r-- 1 user user 2048 Jul 19 file2.txt
-rw-r--r-- 1 user user 2048 Jul 19 file2.txt
user@host:~$ cat missing.txt
⏱ 0.002s | 🕓 10:32:10
cat: missing.txt: No such file or directory
user@host:~$ sleep 5
⏱ 5.002s | 🕓 10:32:12 → 10:32:17 | CPU: 0.0% MEM: 1.2%