chiark / gitweb /
el/dot-emacs.el (mdw-fontify-rust): Fix integer literal syntax.
[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 }; if not {
12   bold = '' unbold = ''
13 }
14
15 if (~ `{id -u} 0) {
16   left = `{echo « | iconv -f utf8 -t //translit}
17   right = `{echo » | iconv -f utf8 -t //translit}
18 }; if not {
19   u = `{id -un}
20   if (~ $u mdw mwooding) {
21     u = '' left = '[' right = ']'
22   }; if not {
23     u = $u^@ left = '{' right = '}'
24   }
25   if (~ $__mdw_tty `{tty}) {
26     left = '<' right = '>'
27   }; if not {
28     __mdw_tty = `{tty}
29   }
30 }
31
32 if (~ $#SSH_CLIENT 0 && ! ~ $__mdw_sechost $host) {
33   sec_l = '(' sec_r = ')'
34 }; if not {
35   sec_l = '' sec_r = ''
36 }
37
38 fn prompt {
39   cwd = `{pwd}
40   if (~ $cwd $home $home/*) {
41     cwd = `{echo $cwd | sed 's:^' ^ $home ^':~:'}
42   }
43   prompt = ($bold$left$sec_l$u$host$sec_r^' '^$cwd$right$unbold '')
44 }
45 prompt
46
47 ###--------------------------------------------------------------------------
48 ### Convenient aliases.
49
50 fn rootly { ~ $#* 0 && * = $SHELL; $__MDW_ROOTLY $* }
51 fn r { rootly $* }
52 fn re { rootly $EDITOR $* }
53 fn pstree { builtin pstree -hl }
54 fn e { $EDITOR $* }
55 fn @ { ssh $* }
56
57 fn ls {
58   if (test -t 1) {
59     builtin ls $LS_OPTIONS '--color=auto' $*
60   }; if not {
61     builtin ls $*
62   }
63 }
64
65 fn greplike {
66   grep = $1; shift
67   if (test -t 1) {
68     builtin $grep '--color=always' $* | mdw-pager
69   }; if not {
70     builtin grep $*
71   }
72 }
73 fn grep { greplike grep $* }
74 fn egrep { greplike egrep $* }
75 fn fgrep { greplike fgrep $* }
76 fn zgrep { greplike zgrep $* }
77
78 if (~ $INSIDE_EMACS 22.*,comint) PAGER = cat
79
80 ###----- That's all, folks --------------------------------------------------