X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/1d89ce867576117e37e22166261cf2aef93b80a6..bfdee8c36e31700e3c744c68489cc8de2c4e2c12:/dot/rcrc diff --git a/dot/rcrc b/dot/rcrc index 2723b2c..39d9435 100644 --- a/dot/rcrc +++ b/dot/rcrc @@ -1,3 +1,4 @@ +### -*-rc-*- ### rc profile ###-------------------------------------------------------------------------- @@ -6,36 +7,71 @@ host = `hostname if (~ $TERM linux* screen* xterm* vt100* eterm*) { - bold = `{tput bold} unbold = `{tput sgr0} + bold = `{tput bold} unbold = `{tput sgr0} } else { - bold = '' unbold = '' + bold = '' unbold = '' } if (~ `{id -u} 0) { - left = `{iconv -f utf8 -t //translit <<< «} - right = `{iconv -f utf8 -t //translit <<< »} + 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 - } + 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 = ')' + 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 '') + cwd = `pwd + if (~ $cwd $home $home/*) { + cwd = `{sed 's:^' ^ $home ^':~:' <<< $cwd} + } + prompt = ($bold$left$sec_l$u$host$sec_r^' '^$cwd$right$unbold '') } + +###-------------------------------------------------------------------------- +### Convenient aliases. + +fn rootly { ~ $#* 0 && * = $SHELL; $__MDW_ROOTLY $* } +fn r { rootly $* } +fn re { rootly $EDITOR $* } +fn pstree { builtin pstree -hl } +fn e { $EDITOR $* } +fn @ { ssh $* } + +fn ls { + if (test -t 1) { + builtin ls $LS_OPTIONS '--color=auto' $* + } else { + builtin ls $* + } +} + +fn greplike { + grep = $1; shift + if (test -t 1) { + builtin $grep '--color=always' $* | mdw-pager + } else { + builtin grep $* + } +} +fn grep { greplike grep $* } +fn egrep { greplike egrep $* } +fn fgrep { greplike fgrep $* } +fn zgrep { greplike zgrep $* } + +if (~ $INSIDE_EMACS 22.*,comint) PAGER = cat + +###----- That's all, folks --------------------------------------------------