dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 79e2240704e275210f9c5f8ce32de9a4ab7ce0fb
parent d59209b7c946494924afb1399b18b6e00a447f25
Author: hhvn <dev@hhvn.uk>
Date:   Sat,  1 Jan 2022 19:16:17 +0000

.rcrc: rc config file

Diffstat:
A.rcrc | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+), 0 deletions(-)

diff --git a/.rcrc b/.rcrc @@ -0,0 +1,97 @@ +# Fuck GNU +if (grep --version >[2=1] | grep GNU >/dev/null) + __prompt_gnu_binary = 'a' + +# Get vi bindings +INPUTRC = $home/.config/readline/inputrc + +# Backend prompt function +fn __prompt { + __prompt_exitcode = $status + if (~ $__prompt_exitcode 0) { + tput setaf 15 + } else { + tput setaf 10 + } + printf '%s ' $__prompt_exitcode + + # username + tput setaf 5 + printf '%s ' `{whoami} + + # branch + tput setaf 3 + printf '%s' `{git branch >[2]/dev/null | + grep '^*' | + awk '{print $2 "|"}'} + + # unstaged changes + __prompt_diff = ``(''){git diff >[2]/dev/null} + if (echo $__prompt_diff | grep '.' >/dev/null) { + if (echo $__prompt_diff | grep '.' >/dev/null) { + tput setaf 8 + } else { + tput setaf 15 + } + + printf '%s+' `{echo $__prompt_diff | + grep '-E'^$__prompt_gnu_binary '^(\+\+\+|---)' | + sed -E 's~^[^a]*a/|^[^b]*b/~~' | + grep -v /dev/null | + uniq | + wc -l | + tr -d '\n'} + } else { + tput setaf 15 + printf '=' + } + + # unpushed commits + __prompt_log = ``(''){git log '--pretty=format:commit %h%d'} + if (echo $__prompt_log | head -n1 | grep -v '.*\/.*' >/dev/null) { + tput setaf 14 + echo $__prompt_log | awk '-vc=0' ' + /^commit/ { + if ($0 ~ /\//) { + printf("%d", c) + exit + } + }' + printf '^' + } + + # dir + tput setaf 7 + printf ' %s' `{pwd | sed 's~' ^ $home ^ '~\~~'} + + # end + printf '$ ' + tput sgr0 +} + +# Frontend prompt function +fn prompt { + __prompt_content = ``(''){__prompt} + prompt = ($__prompt_content '') +} + +# Aliases +fn g { git $* } +fn vsplit { vim -O } +if (~ `{uname} 'Linux') + fn ls { builtin ls --color $* } +fn v { nvim $* } +fn xi { doas xbps-install $*} +fn xr { doas xbps-remove $*} +fn xq { doas xbps-query $*} +fn ytdl { youtube-dl --add-metadata -ic $* } +fn ytdla { youtube-dl --add-metadata -xic $* } +fn tmux { builtin tmux -f $home/.config/tmux/config $* } +fn sloccount { + mkdir -p $home/.local/sloccount + builtin sloccount --datadir $home/.local/sloccount $* +} +fn camerasync { + rsync -azP /mnt/DCIM/* ~/general/images/byme" +} +fn wtf { builtin wtf -o }