.rcrc (2937B)
1 fn sigexit { 2 __prompt_cleanup 3 for (f in $manconfs) { 4 rm -f $f 5 } 6 } 7 8 fn prompt { 9 prompt = (`''{builtin prompt $status} '>') 10 } 11 12 # Aliases 13 fn g { git $* } 14 fn vsplit { vim -O $* } 15 if (~ `{uname} 'Linux') { 16 fn ls { 17 if (flag i) { 18 builtin ls -FC --color $* 19 } else { 20 # rc exports all functions, 21 # so we need to act normal 22 # when not interactive. 23 builtin ls $* 24 } 25 } 26 } 27 fn v { nvim $* } 28 fn xi { doas xbps-install $*} 29 fn xr { doas xbps-remove $*} 30 fn xq { doas xbps-query $*} 31 fn ytdl { yt-dlp --add-metadata -ic $* } 32 fn ytdla { yt-dlp --add-metadata -xic $* } 33 fn tmux { builtin tmux -f $home/.config/tmux/config $* } 34 fn sloccount { 35 mkdir -p $home/.local/sloccount 36 builtin sloccount --datadir $home/.local/sloccount $* 37 } 38 fn camerasync { 39 rsync -azP /mnt/DCIM/* $home/photos 40 } 41 fn wtf { 42 if (flag i) { 43 builtin wtf -o $* 44 } else { 45 builtin wtf $* 46 } 47 } 48 fn w3m { 49 # Symlink $home/.config/w3m -> $home/.config/.w3m 50 home = $home/.config { builtin w3m $* } 51 } 52 fn gpg { builtin gpg --armor $* } 53 fn convert { 54 if (flag i) { 55 builtin convert -monitor $* 56 } else { 57 builtin convert $* 58 } 59 } 60 fn dict { 61 @{ 62 if (flag i) { 63 argv = () 64 for (arg in $*) { 65 argv = ($argv `''{printf '%s' $arg | sed -E 's~dict://[^/]*/.:(.*)~\1~'}) 66 } 67 } else { 68 argv = $* 69 } 70 builtin dict $argv 71 } 72 } 73 74 # Evaluate command with rc 75 fn doas { 76 opts = () exec = () args = () { 77 while (~ $1 -*) { 78 if (~ $1 *[Cu]) { 79 opts = ($opts $1 $2) 80 shift 2 81 } else { 82 opts = ($opts $1) 83 shift 84 } 85 } 86 87 args=`''{whatis '*' | sed -E 's~^\*=\(?~~;s~\)$~~' | head -c -1} 88 89 builtin doas $opts rc -c $args 90 } 91 } 92 93 fn feeds { 94 SFEED_URL_FILE=$home/.local/sfeed-read 95 sfeed_curses $home/.local/sfeed/* 96 } 97 98 # Enable coredumps of practically infinite size. 99 limit coredumpsize 99999999 100 101 # .profile 102 CC = clang 103 INPUTRC = $home/.config/readline/inputrc 104 EDITOR = nvim 105 PAGER = less 106 TERMINAL= st 107 PASS = $home/.local/pass 108 SHELL = /bin/rc 109 110 . $home/.config/user-dirs.dirs 111 XDG_CONFIG_HOME = $home/.config 112 XDG_CACHE_HOME = $home/.cache 113 XAUTHORITY = $home/.local/.xauth 114 LESSHISTFILE = - 115 HISTFILE = $home/.local/history 116 GNUPGHOME = $home/.local/gnupg 117 IPFS_PATH = $home/.local/ipfs 118 CURLHOME = $home/.config/curl/" 119 LS_COLORS = `''{<$home/.config/ls tr -d ' ' | tr '\n' ':' | tr -s ':'} 120 121 ANDROID_HOME=$home/.android-sdk 122 123 history = $XDG_CACHE_HOME/history 124 # Originally I had $HOME/.scripts placed before the regular $PATH to override 125 # things, however this can mess with traditional unix shells that don't 126 # understand subdirs in $PATH. Say you have rm/script1 and rm/script2: rc will 127 # still run the regular /bin/rm, but sh will go 'ah, let's try execute this 128 # directory and see what happens' - of course nothing happens and it gives up 129 # on trying to locate rm. 130 if (!~ $rcrcdone true) { 131 path = ($path $home/cmd/ $home/mail/.cmd $home/go/bin /usr/lib/plan9/bin) 132 } 133 134 . /etc/locale.conf 135 136 if (~ `{tty} /dev/tty1) { 137 doas net/autoconf 138 startx 139 } 140 141 rcrcdone = true