summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2023-02-01 08:25:47 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2023-02-12 10:26:12 +0100
commitb3c2ffbf9edbbdd6bd6cb1769543c4093f15f835 (patch)
tree7ef91dc5f4e20a0611106b4c2b38b237e5884d20
parent25f04e5bff8b3f5d28df0baf647b554657f50b0a (diff)
downloaddotfiles-b3c2ffbf9edbbdd6bd6cb1769543c4093f15f835.tar.xz
Absorb .bashrc bits hoarded from machine to machine for eons
* inputrc goodies, * let readline see C-s, * reverse PS4 for kicks, * protect crippled shells (M-x shell, batch ssh commands) from this savagery.
-rw-r--r--.bash_inputrc5
-rw-r--r--.bash_prompt48
2 files changed, 38 insertions, 15 deletions
diff --git a/.bash_inputrc b/.bash_inputrc
new file mode 100644
index 0000000..f3fc295
--- /dev/null
+++ b/.bash_inputrc
@@ -0,0 +1,5 @@
+set blink-matching-paren
+set colored-completion-prefix on
+set colored-stats on
+set enable-active-region on
+set skip-completed-text
diff --git a/.bash_prompt b/.bash_prompt
index 0cd8d4b..4777251 100644
--- a/.bash_prompt
+++ b/.bash_prompt
@@ -81,6 +81,7 @@ __fontify ()
local -A codes=(
[bold]=1
[dim]=2
+ [reverse]=7
[red]=31
[green]=32
[blue]=34
@@ -204,24 +205,41 @@ __refresh-terminal ()
__set-prompt
}
+__init-smart ()
+{
+ ### Prompts.
-PS2='… '
+ PS2=$(__fontify '… ' dim)
+ export PS4=$(__fontify "${PS4}" reverse)
-if [ "${TERM}" = dumb ]
-then
- PS1='$? \u:\w\$ '
- return
-fi
+ if __have-gitprompt
+ then
+ . /usr/lib/git-core/git-sh-prompt
+ GIT_PS1_SHOWDIRTYSTATE=t
+ GIT_PS1_SHOWUPSTREAM=auto
-PS2=$(__fontify "${PS2}" dim)
+ PS1_SHOWGITSTATUS=t
+ fi
-if __have-gitprompt
-then
- . /usr/lib/git-core/git-sh-prompt
- GIT_PS1_SHOWDIRTYSTATE=t
- GIT_PS1_SHOWUPSTREAM=auto
+ PROMPT_COMMAND=__refresh-terminal
- PS1_SHOWGITSTATUS=t
-fi
+ ### Bindings.
+
+ bind -f ~/.bash_inputrc
-PROMPT_COMMAND=__refresh-terminal
+ # Unset the TTY's "stop" char, so that readline receives C-s.
+ if tty -s
+ then
+ stty stop ''
+ fi
+}
+
+
+if [ "${TERM}" = dumb ]
+then
+ PS1='$? \u:\w\$ '
+ PS2='> '
+ export PS4='+ '
+else
+ __init-smart
+fi