chiark / gitweb /
dot/rcrc: Configuration for the Plan 9 shell.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 23 Oct 2010 12:20:11 +0000 (13:20 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 23 Oct 2010 12:20:11 +0000 (13:20 +0100)
This needs a login to make it actually work, which is a little
annoying.  I've added aliases appropriately.

dot/rcrc [new file with mode: 0644]
setup

diff --git a/dot/rcrc b/dot/rcrc
new file mode 100644 (file)
index 0000000..2723b2c
--- /dev/null
+++ b/dot/rcrc
@@ -0,0 +1,41 @@
+### rc profile
+
+###--------------------------------------------------------------------------
+### Prompt machinery.
+
+host = `hostname
+
+if (~ $TERM linux* screen* xterm* vt100* eterm*) {
+       bold = `{tput bold} unbold = `{tput sgr0}
+} else {
+       bold = '' unbold = ''
+}
+
+if (~ `{id -u} 0) {
+       left = `{iconv -f utf8 -t //translit <<< «}
+       right = `{iconv -f utf8 -t //translit <<< »}
+} else {
+       u = `{id -un}
+       if (~ $u mdw mwooding) {
+               u = '' left = '[' right = ']'
+       } else {
+               u = $u^@ left = '{' right = '}'
+       }
+       if (~ $__mdw_tty `tty) {
+               left = '<' right = '>'
+       } else {
+               __mdw_tty = `tty
+       }
+}
+
+if (~ $#SSH_CLIENT 0 && ! ~ $__mdw_sechost $host) {
+       sec_l = '(' sec_r = ')'
+}
+
+fn prompt {
+       cwd = `pwd
+       if (~ $cwd $home $home/*) {
+               cwd = `{sed 's:^' ^ $home ^':~:' <<< $cwd}
+       }
+       prompt = ($bold$left$sec_l$u$host$sec_r^' '^$cwd$right$unbold '')
+}
diff --git a/setup b/setup
index 499841e3197e64f151c27102a9bc012b2057bd27..5242bd81a6cb93028d9421517e063f4b434e928c 100755 (executable)
--- a/setup
+++ b/setup
@@ -135,6 +135,7 @@ dotfiles="
   cgrc tigrc
   gdbinit
   guile
+  rcrc
   toprc
   aspell.conf
   lisp-init.lisp:.cmucl-init.lisp