chiark / gitweb /
dot/bash*, dot/rcrc: Force correct shell support in Emacs.
[profile] / dot / rcrc
1 ### -*-rc-*-
2 ### rc profile
3
4 ###--------------------------------------------------------------------------
5 ### Prompt machinery.
6
7 host = `hostname
8
9 if (~ $TERM linux* screen* xterm* vt100* eterm*) {
10         bold = `{tput bold} unbold = `{tput sgr0}
11 } else {
12         bold = '' unbold = ''
13 }
14
15 if (~ `{id -u} 0) {
16         left = `{iconv -f utf8 -t //translit <<< «}
17         right = `{iconv -f utf8 -t //translit <<< »}
18 } else {
19         u = `{id -un}
20         if (~ $u mdw mwooding) {
21                 u = '' left = '[' right = ']'
22         } else {
23                 u = $u^@ left = '{' right = '}'
24         }
25         if (~ $__mdw_tty `tty) {
26                 left = '<' right = '>'
27         } else {
28                 __mdw_tty = `tty
29         }
30 }
31
32 if (~ $#SSH_CLIENT 0 && ! ~ $__mdw_sechost $host) {
33         sec_l = '(' sec_r = ')'
34 }
35
36 fn prompt {
37         cwd = `pwd
38         if (~ $cwd $home $home/*) {
39                 cwd = `{sed 's:^' ^ $home ^':~:' <<< $cwd}
40         }
41         prompt = ($bold$left$sec_l$u$host$sec_r^' '^$cwd$right$unbold '')
42 }