| Age | Commit message (Collapse) | Author |
|
[ COND ] → test COND
if COND then LIST fi → COND && LIST
echo -en TEXT → printf $'TEXT'
for … → IFS=c eval 'VAR="${ARRAY[*]}"
[ A -op B ] → ((A OP B))
|
|
The prefixes that all this code shaves are fairly small, all things
considered. Not sure this code carries its own weight.
|
|
|
|
|
|
Relic of 2023-02-12 "Absorb .bashrc bits hoarded from machine to
machine for eons" (b3c2ffb), obsoleted by 2023-02-12 "Give up on
colored PS4" (ec4b87b).
|
|
|
|
The first mistake here was to forget to wrap console codes with \[…\];
for some reason though after adding those…
export PS4=$(echo -en '\[\e[7m\]+ \[\e[0m\]')
… bash no longer repeats the first character (+) according to the
indirection level, or rather, it repeats an entirely unrelated
character:
$ ( PS4='+ ' ; set -x ; echo $(echo $(echo hi | grep hi)) )
+++ echo hi
+++ grep --color=auto hi
++ echo hi
+ echo hi
hi
$ ( PS4=$(echo -en '\[\e[7m\]+ \[\e[0m\]')
set -x
echo $(echo $(echo hi | grep hi))
) |& hexdump -C
00000000 01 01 01 1b 5b 37 6d 02 2b 20 01 1b 5b 30 6d 02 |....[7m.+ ..[0m.|
^^ ^^ ^^ (echo)
00000010 65 63 68 6f 20 68 69 0a 01 01 01 1b 5b 37 6d 02 |echo hi.....[7m.|
^^ ^^ ^^ (grep)
00000020 2b 20 01 1b 5b 30 6d 02 67 72 65 70 20 2d 2d 63 |+ ..[0m.grep --c|
00000030 6f 6c 6f 72 3d 61 75 74 6f 20 68 69 0a 01 01 1b |olor=auto hi....|
^^ ^^ (echo)
00000040 5b 37 6d 02 2b 20 01 1b 5b 30 6d 02 65 63 68 6f |[7m.+ ..[0m.echo|
00000050 20 68 69 0a 01 1b 5b 37 6d 02 2b 20 01 1b 5b 30 | hi...[7m.+ ..[0|
^^ (echo)
00000060 6d 02 65 63 68 6f 20 68 69 0a 68 69 0a |m.echo hi.hi.|
0000006d
No idea where those ^A characters come from.
While at it, wrap PS2 to avoid line-wrapping shenanigans.
|
|
* inputrc goodies,
* let readline see C-s,
* reverse PS4 for kicks,
* protect crippled shells (M-x shell, batch ssh commands) from this
savagery.
|
|
TTYs seem to have a glyph for that one.
|
|
|
|
|
|
|
|
|
|
Because I'm a Unicode hipster.
Also move the "dumb" check below function definitions, so that maybe
someday I can try to play with those functions in shell-mode.
|
|
|
|
Otherwise Emacs picks it up when started from a terminal, defeating my
attempt to shield M-x shell from my weird-ass prompt.
|
|
|
|
I've seen the prohibited sign elsewhere before (on Github IIRC),
I find it neat.
Using the box drawing rather than the long dash ensures the line looks
continuous even in TTYs.
|
|
Simplifies the code somewhat; less arguments to pass around.
|
|
- no newline: simply append a visible /
- error code: move to first line and make rule red
|
|
User/host/working-directory/Git status go on the first line; the
"prompt" line only contains the prompt symbol and the previous
command's error code.
Also fill the rest of the line when a command does not end with
a newline.
|
|
- remove speculative parentheses
- sort table by code
|
|
To reproduce the issue:
$ echo -e '\E[?7l'
(cf. console_codes(4))
|
|
TRAMP fails to connect to remote hosts that set this prompt.
|
|
bash(1) already mentions _profile, _login, _logout and _history.
.bashrc adds .bash_aliases (although .bashrc itself is an exception).
|