summaryrefslogtreecommitdiff
path: root/.bash_prompt
AgeCommit message (Collapse)Author
2025-10-04Season bash to tasteKévin Le Gouguec
[ 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))
2025-10-04Stop special-casing Git repos in console window titlesKévin Le Gouguec
The prefixes that all this code shaves are fairly small, all things considered. Not sure this code carries its own weight.
2025-10-04Adjust prompt for M-x shellKévin Le Gouguec
2025-10-04"Namespace" PS1 functions for less-than-dumb terminalsKévin Le Gouguec
2025-10-04Stop resetting PS4 for 'dumb' TERMsKévin Le Gouguec
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).
2025-10-04Nudge Emacs awakeKévin Le Gouguec
2023-02-12Give up on colored PS4Kévin Le Gouguec
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.
2023-02-12Absorb .bashrc bits hoarded from machine to machine for eonsKévin Le Gouguec
* inputrc goodies, * let readline see C-s, * reverse PS4 for kicks, * protect crippled shells (M-x shell, batch ssh commands) from this savagery.
2022-02-06Change "no newline" symbolKévin Le Gouguec
TTYs seem to have a glyph for that one.
2021-12-27Make Bash prompt less busyKévin Le Gouguec
2021-08-01Show full hostname in promptKévin Le Gouguec
2021-04-27Tweak window title for terminal emulatorsKévin Le Gouguec
2020-02-01Fix bash prompt functions overwriting shell variablesKévin Le Gouguec
2018-01-21Set PS2 to "… "Kévin Le Gouguec
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.
2017-10-30Shorten prompt for M-x shellKévin Le Gouguec
2017-10-30Stop exporting PROMPT_COMMANDKévin Le Gouguec
Otherwise Emacs picks it up when started from a terminal, defeating my attempt to shield M-x shell from my weird-ass prompt.
2017-03-07(m) Simplify code and tweak whitespaceKévin Le Gouguec
2017-03-02Change no-newline and rule charactersKévin Le Gouguec
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.
2017-03-02Move horizontal rule out of promptKévin Le Gouguec
Simplifies the code somewhat; less arguments to pass around.
2017-03-02Change no-newline and error code reportingKévin Le Gouguec
- no newline: simply append a visible / - error code: move to first line and make rule red
2017-03-01Split prompt into two linesKévin Le Gouguec
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.
2017-03-01(m) CleanupKévin Le Gouguec
- remove speculative parentheses - sort table by code
2017-02-28Make sure the prompt works when autowrap is offKévin Le Gouguec
To reproduce the issue: $ echo -e '\E[?7l' (cf. console_codes(4))
2017-01-16Work around TRAMP issueKévin Le Gouguec
TRAMP fails to connect to remote hosts that set this prompt.
2017-01-16Rename script to fit existing conventionKévin Le Gouguec
bash(1) already mentions _profile, _login, _logout and _history. .bashrc adds .bash_aliases (although .bashrc itself is an exception).