dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 0835b0e9a68888a2c7dafe3a60cd6bd4c4692002
parent 9f23745ce900d3f2b96b14ce121a3e0d9aeaba39
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat, 29 Aug 2020 05:52:13 -0400

Add rc shell config

Diffstat:
Aetc/profile.d/01-brew.rc | 10++++++++++
Aetc/profile.d/01-cargo.rc | 4++++
Aetc/profile.d/10-browser.rc | 20++++++++++++++++++++
Aetc/profile.d/10-editor.rc | 6++++++
Aetc/profile.d/10-go.rc | 3+++
Aetc/profile.d/10-gpg.rc | 11+++++++++++
Aetc/profile.d/10-hostname.rc | 1+
Aetc/profile.d/10-logname.rc | 6++++++
Aetc/profile.d/10-pager.rc | 16++++++++++++++++
Aetc/profile.d/10-visual.rc | 9+++++++++
Aetc/profile.d/10-xdg.rc | 3+++
Aetc/profile.d/99-my.rc | 4++++
Alib/functions.rc.d/dotfiles.rc | 7+++++++
Alib/functions.rc.d/editor.rc | 3+++
Alib/functions.rc.d/feh.rc | 3+++
Alib/functions.rc.d/num.rc | 3+++
Alib/functions.rc.d/proj.rc | 8++++++++
Alib/functions.rc.d/rsync.rc | 17+++++++++++++++++
Alib/functions.rc.d/ssh.rc | 7+++++++
Alib/functions.rc.d/tmux.rc | 15+++++++++++++++
Alib/profile | 23+++++++++++++++++++++++
21 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/etc/profile.d/01-brew.rc b/etc/profile.d/01-brew.rc @@ -0,0 +1,10 @@ +if(which brew >/dev/null >[2=1]) { + HOMEBREW_NO_ANALYTICS=1 + HOMEBREW_NO_INSECURE_REDIRECT=1 + HOMEBREW_CASK_OPTS=(--require-sha --appdir=$hone/Applications) + HOMEBREW_NO_AUTO_UPDATE=1 + if(~ $path *^`{brew -prefix}/bin^*) {} + if not { + path=(`{brew --prefix}/bin $path) + } +} diff --git a/etc/profile.d/01-cargo.rc b/etc/profile.d/01-cargo.rc @@ -0,0 +1,4 @@ +if(~ $path *^$home/.cargo/bin^*) {} +if not { + path=($path $home/.cargo/bin) +} diff --git a/etc/profile.d/10-browser.rc b/etc/profile.d/10-browser.rc @@ -0,0 +1,20 @@ +if(~ $#DISPLAY 0) { + if(which lynx >/dev/null >[2=1]) { + BROWSER=lynx + } + if(which w3m >/dev/null >[2=1]) { + BROWSER=w3m + WWW_HOME=https://www.danielmoch.com + } +} +if not { + if(which firefox >/dev/null >[2=1]) { + BROWSER=firefox + } + if(which firefox-esr >/dev/null >[2=1]) { + BROWSER=firefox-esr + } + if(which surf >/dev/null >[2=1]) { + BROWSER=surf + } +} diff --git a/etc/profile.d/10-editor.rc b/etc/profile.d/10-editor.rc @@ -0,0 +1,6 @@ +if(~ $#DISPLAY 0) { + EDITOR=(sam -d) +} +if not { + EDITOR=E +} diff --git a/etc/profile.d/10-go.rc b/etc/profile.d/10-go.rc @@ -0,0 +1,3 @@ +if(which go >/dev/null >[2=1]) { + GOPATH=$home +} diff --git a/etc/profile.d/10-gpg.rc b/etc/profile.d/10-gpg.rc @@ -0,0 +1,11 @@ +if(test -z $SSH_TTY && which gpgconf >/dev/null >[2=1]) { + if(test `{gpgconf --list-dirs agent-ssh-socket | wc -l} -eq 1) { + SSH_AGENT_PID=() + SSH_AUTH_SOCK=`{gpgconf --list-dirs agent-ssh-socket} + } +} + +if(which gpg-connect-agent >/dev/null >[2=1]) { + GPG_TTY=`{tty} + gpg-connect-agent updatestartuptty /bye >/dev/null >[2=1] +} diff --git a/etc/profile.d/10-hostname.rc b/etc/profile.d/10-hostname.rc @@ -0,0 +1 @@ +HOSTNAME=`{uname -n|cut -d. -f1} diff --git a/etc/profile.d/10-logname.rc b/etc/profile.d/10-logname.rc @@ -0,0 +1,6 @@ +if(logname >/dev/null >[2=1]) { + LOGNAME=`{logname} +} +if not { + LOGNAME=`{basename $home} +} diff --git a/etc/profile.d/10-pager.rc b/etc/profile.d/10-pager.rc @@ -0,0 +1,16 @@ +if(test "$TERM" = "dumb") { + PAGER=nobs +} +if(~ $#PAGER 0 && which less >/dev/null >[2=1]) { + PAGER=less + LESS='-FMRqX#10' + if(which lesspipe >/dev/null >[2=1]) { + eval `{lesspipe} + } + if not { + LESSOPEN='|$home/.lessfilter %s' + } +} +if(~ $#PAGER 0) { + PAGER=more +} diff --git a/etc/profile.d/10-visual.rc b/etc/profile.d/10-visual.rc @@ -0,0 +1,9 @@ +if(~ $#DISPLAY 0) { + VISUAL=vi + if(which vis >/dev/null >[2=1]) { + VISUAL=vis + } + if(which vise >/dev/null >[2=1]) { + VISUAL=vise + } +} diff --git a/etc/profile.d/10-xdg.rc b/etc/profile.d/10-xdg.rc @@ -0,0 +1,3 @@ +XDG_CONFIG_HOME=$home/etc +XDG_CACHE_HOME=$home/var/cache +XDG_DATA_HOME=$home/lib/share diff --git a/etc/profile.d/99-my.rc b/etc/profile.d/99-my.rc @@ -0,0 +1,4 @@ +if(~ $path *^$home/bin^*) {} +if not { + path=($home/bin $path) +} diff --git a/lib/functions.rc.d/dotfiles.rc b/lib/functions.rc.d/dotfiles.rc @@ -0,0 +1,7 @@ +fn dotfiles { + git --git-dir=$home/.dotfiles --work-tree=$home $* +} + +fn dot { + dotfiles $* +} diff --git a/lib/functions.rc.d/editor.rc b/lib/functions.rc.d/editor.rc @@ -0,0 +1,3 @@ +fn e { + $EDITOR $* +} diff --git a/lib/functions.rc.d/feh.rc b/lib/functions.rc.d/feh.rc @@ -0,0 +1,3 @@ +fn feh { + `{which feh} --auto-rotate --scale-down $* +} diff --git a/lib/functions.rc.d/num.rc b/lib/functions.rc.d/num.rc @@ -0,0 +1,3 @@ +fn num { + pr -tn $*(1) | $PAGER +} diff --git a/lib/functions.rc.d/proj.rc b/lib/functions.rc.d/proj.rc @@ -0,0 +1,8 @@ +fn proj { + if(test -d $home/src/$*(1)) { + cd $home/src/$*(1) + if(test -r .env) { + . ./.env + } + } +} diff --git a/lib/functions.rc.d/rsync.rc b/lib/functions.rc.d/rsync.rc @@ -0,0 +1,17 @@ +fn rsync { + if(which openrsync >/dev/null >[2=1]) { + rsync=openrsync + } + if(~ $#rsync 0 && which rsync >/dev/null >[2=1]) { + rsync=rsync + } + + switch($rsync) { + case openrsync + `{which openrsync} --rsync-path=`{which openrsync} $* + case rsync + `{which rsync} -C --include=.git $* + case * + echo 'rsync: No such file or directory' + } +} diff --git a/lib/functions.rc.d/ssh.rc b/lib/functions.rc.d/ssh.rc @@ -0,0 +1,7 @@ +fn ssh { + `{which ssh} $* + switch($TERM) { + case xterm* rxvt* st* tmux* + printf '\033]0;%s@%s\007' $LOGNAME $HOSTNAME + } +} diff --git a/lib/functions.rc.d/tmux.rc b/lib/functions.rc.d/tmux.rc @@ -0,0 +1,15 @@ +fn tas { + tmux attach-session -t $* +} + +fn tns { + tmux new-session -s $* +} + +fn tls { + tmux list-sessions $* +} + +fn ts { + tmux-session $* +} diff --git a/lib/profile b/lib/profile @@ -0,0 +1,23 @@ +# +# $home/lib/profile +# + +if(which my-init >/dev/null >[2=1] && test ! -f $home/._.djmoch) { + my-init +} + +for(file in $home/etc/profile.d/*.rc) { + if(test -r $file) { + . $file + } +} + +for(file in $HOME/lib/functions.rc.d/*.rc) { + if(test -r $file) { + . $file + } +} + +if(~ $#DISPLAY 0) { + my login +}