Skip to content

Instantly share code, notes, and snippets.

@mattlevan
Created November 8, 2017 19:01
Show Gist options
  • Save mattlevan/d3d9201d77f6fa99b2540aaf975aa857 to your computer and use it in GitHub Desktop.
Save mattlevan/d3d9201d77f6fa99b2540aaf975aa857 to your computer and use it in GitHub Desktop.
fish config for Urbit development
alias ranger='ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR'
### mirror a into b on change
#TODO figure out a way to kill this more simply.
function mirror
fswatch $argv[1] -e '\.git' | \
while read file;
echo (date "+%Y-%m-%d %H:%M:%S") "$file"
cp -r $argv[1] $argv[2]
end
end
### stop mirroring of a
function unmir
pkill -f fswatch $argv[1]
end
# ~pittyp-datfyn+ re: killing fish processes, i have a bunch of
# ~pittyp-datfyn+ function foo; fish -c foo-main $argv &
# ~pittyp-datfyn+ function foo-main ...
# ~pittyp-datfyn+ which you can then kill %1 or w/e using normal job control
### spin up fake galaxy
function fake
if test -d fake-$argv[1]-$argv[2]
if test (count $argv) -ge 3
mv -f fake-$argv[1]-$argv[2] fake-prev-$argv[1]-$argv[2]
urbit -F -I $argv[1] -A ~/repos/Urbit/arvo-$argv[2] -c fake-$argv[1]-$argv[2]
else
urbit -F -I $argv[1] fake-$argv[1]-$argv[2]
end
else
urbit -F -I $argv[1] -A ~/repos/Urbit/arvo-$argv[2] -c fake-$argv[1]-$argv[2]
end
end
### back up fake galaxy
function bake
cp -rf fake-$argv[1]-$argv[2] fake-bak-$argv[1]-$argv[2]
end
### restore fake galaxy
function rake
cp -rf fake-bak-$argv[1]-$argv[2] fake-$argv[1]-$argv[2]
end
### run a task in the background
function background --description "Run a fish command in the background using a bash subshell"
bash -c "fish -c '""$argv""' &"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment