etc/profile

201 lines
4.1 KiB
Text
Raw Normal View History

2020-11-04 05:48:02 +03:00
# k1574's rc configuration file.
2020-11-04 02:03:20 +03:00
2021-12-04 21:57:51 +03:00
SHLVL = `{echo $SHLVL + 1 | bc}
oldifs = $ifs
2020-11-04 02:03:20 +03:00
prompt = '% ' # The simplest possible prompt.
fn % {
switch($#*){
case 0
case *
$*
}
}
txt = $home/shr # Directory for notes, lists etc.
tmpl = $home/tmpl # Templates.
doc = $home/doc # Documents.
lib = $home/lib # Configuration for other applications.
txt = $home/txt # Plain text files. Lists, notes etc.
load = $home/load # Downloads.
2020-11-10 04:58:56 +03:00
mnt = $home/mnt # Mount.
2020-12-15 21:34:19 +03:00
pub = $home/pub # Public share.
2020-11-04 02:03:20 +03:00
vid = $home/vid # Video files.
2020-12-11 03:40:13 +03:00
snd = $home/snd # Audio files.
2020-11-04 02:03:20 +03:00
img = $home/img # Image files.
app = $home/app # Program installation directory.
env = $home/env # Environment setting directory.
dev = $home/dev # Development.
#etc = $local/etc # Configuration files for any system.
2020-11-04 05:48:02 +03:00
exe = $home/exe # Executable binaries installation directory.
2020-11-04 02:03:20 +03:00
tmp = $home/tmp # Temporary.
shr = $home/shr # Share files for programs.
man = $shr/man # Directory for manual pages. Are supposed to be written in plain text.
2021-02-17 02:36:56 +03:00
git = https://github.com/$USER
pager = less # Pager deleting all ESC-sequences. For 9term mostly.
2020-11-04 02:03:20 +03:00
manpager = $pager # Pager for man pages.
profile = $0 # Profile file.
2021-12-04 21:57:51 +03:00
indent = ' ' # Indent for programming.
2020-11-04 02:03:20 +03:00
inferno = $app/inferno # Inferno.
infernoexe = `{ # Inferno executables files.
sys = `{uname}
machine = `{uname -m}
if(test $machine '=' x86_64){
machine = 386
}
echo $inferno/$sys/$machine/bin
}
plan9 = $app/plan9 # Plan9.
2021-12-04 21:57:51 +03:00
plan9exe= $plan9/bin # Plan9 exe files.
2020-11-04 02:03:20 +03:00
gopath = $app/go # Golang path.
2021-06-15 05:48:00 +03:00
vpath = $app/v # VLang binaries and scripts.
2021-12-04 21:57:51 +03:00
vexe = $vpath # VLang executives.
2020-11-04 02:03:20 +03:00
setenv = $lib/setenv/rc # Setting environment script.
2021-12-04 21:57:51 +03:00
composerexe = $lib/composer/vendor/bin # PHP executive shit.
editor = vi
2020-11-04 02:03:20 +03:00
shell = rc
2021-12-04 21:57:51 +03:00
path = ( $home/exe $path $home $plan9exe $infernoexe $vexe $composerexe )
# Prevent path from growing because of running many "rc"s.
2020-11-04 02:03:20 +03:00
if(which goblin >/dev/null >[2=1]){
path = `{
{ for( i in $path) echo $i } | goblin uniq -U
}
}
# Xorg.
xinitrc = $lib/xinitrc
xresources = $lib/xresources
xmodmap = $lib/xmodmap
switch( `{uname} ){
case ( Linux NetBSD DragonFly OpenBSD FreeBSD ) # On Unix-like systems.
2021-07-29 11:07:03 +03:00
if(which aes >/dev/null >[2=1]){
2021-06-15 05:48:00 +03:00
LESS_TERMCAP_md = `{aes fg-red bold }
LESS_TERMCAP_me = `{aes end}
LESS_TERMCAP_us = `{aes fg-green bold}
LESS_TERMCAP_ue = `{aes end}
LESS_TERMCAP_so = `{aes fg-yellow}
LESS_TERMCAP_se = `{aes end}
LESS_TERMCAP_mb = `{aes fg-cyan}
LESS_TERMCAP_me = `{aes end}
}
if not {
LESS_TERMCAP_md = `{ perl -e 'print "\033[1;31m" ;' }
LESS_TERMCAP_me = `{ perl -e 'print "\033[0m" ;' }
# Underlined.
LESS_TERMCAP_us = `{ perl -e 'print "\033[1;32m" ;' }
LESS_TERMCAP_ue = `{ perl -e 'print "\033[0m" ;' }
# Service info.
LESS_TERMCAP_so = `{ perl -e 'print "\033[1;33m ";' }
LESS_TERMCAP_se = `{ perl -e 'print "\033[0m" ;' }
# Blinking color.
LESS_TERMCAP_mb = `{ perl -e 'print "\033[1;32m" ;' }
LESS_TERMCAP_me = `{ perl -e 'print "\033[0m" ;' }
}
2020-11-04 02:03:20 +03:00
case *
# Nothing in non-Unix systems.
}
fn .. {
# Move in to parent directory $1 times.
if(test -z $1)
builtin cd ..
if not
for(i in `{seq $1})
builtin cd ..
cds = (`{pwd} $cds)
}
fn l {
goblin ls $* | goblin quote | fmt
}
fn ll {
goblin ls $* | finfo
}
2021-12-16 15:33:16 +03:00
maxcds = 50
cdfile = $tmp/cdfile
2021-07-29 11:07:03 +03:00
if(! test -d `{dirname $cdfile}) mkdir `{dirname $cdfile}
if(! test -r $cdfile) touch $cdfile
2021-12-16 15:33:16 +03:00
tmpcdfile = `{mktemp}
2021-12-16 15:33:16 +03:00
fn c {
2020-11-04 02:03:20 +03:00
# History implementation.
2022-01-22 19:15:23 +03:00
oldpwd = `{pwd}
2021-06-15 18:25:29 +03:00
if(builtin cd $1 && test -n $1){
2021-12-16 15:33:16 +03:00
cat $cdfile > $tmpcdfile
2022-01-22 19:15:23 +03:00
{echo $oldpwd ; cat $tmpcdfile } | \
2021-12-16 15:33:16 +03:00
sed $maxcds^q | goblin uniq -U > $cdfile
2021-06-15 18:25:29 +03:00
}
2020-11-04 02:03:20 +03:00
}
2021-12-16 15:33:16 +03:00
fn cd {
c $*
}
2020-11-04 02:03:20 +03:00
fn - {
# Move back in history for $1 notes.
2021-11-30 03:48:21 +03:00
num = $1
2021-06-15 18:25:29 +03:00
if(~ $#* 0)
2021-11-30 03:48:21 +03:00
num = 1
2021-12-16 15:33:16 +03:00
backcd = `{sed -n $num^p $"cdfile}
builtin cd $backcd
2020-11-04 02:03:20 +03:00
}
fn cds {
# Print history.
2021-12-16 15:33:16 +03:00
cat $cdfile | nl >[2]/dev/null
2020-11-04 02:03:20 +03:00
}
2021-06-29 12:20:32 +03:00
fn hcds {
cds | head >[2]/dev/null
2021-06-29 12:20:32 +03:00
}
2020-11-04 02:03:20 +03:00
fn p {
plumb $*
}
fn e {
$editor $*
}
2021-02-17 02:36:56 +03:00
fn q {
2021-12-04 21:57:51 +03:00
echo $SHLVL - 1 | bc
2021-02-17 02:36:56 +03:00
exit
}
2021-08-19 23:14:34 +03:00
fn uprofile {
. $profile
}
2021-09-05 06:25:02 +03:00
fn noerr {
{$*} >[2]/dev/null
}
fn nostd {
{$*} >[1]/dev/null
}
2021-08-15 00:28:43 +03:00
fn m {
for(i in $*){
2021-09-05 06:25:02 +03:00
if(test -r $man/$i){
man $man/$i | less
}
if not {
man $i | less
}
2021-08-15 00:28:43 +03:00
}
}
2020-11-04 02:03:20 +03:00
# Setting enviroment.
if(test -r $setenv){
. $setenv
setenv rc
}
2020-11-04 05:48:02 +03:00