Skip to content

Instantly share code, notes, and snippets.

@thomasritz
Last active March 8, 2018 05:32
Show Gist options
  • Save thomasritz/d2290fc8197b44cbddf0f9b1ca1b01b2 to your computer and use it in GitHub Desktop.
Save thomasritz/d2290fc8197b44cbddf0f9b1ca1b01b2 to your computer and use it in GitHub Desktop.
elvish direnv integration
# ~/.elvish/lib/direnv.elv
fn hook []{
env = (or (direnv export json | from-json) [&])
if (> (count $env) 0) {
f = (mktemp)
keys $env | each [k]{ echo "E:"$k" = \""$env[$k]"\"" >> $f }
-source $f
rm -f $f
}
}
fn setup {
edit:before-readline=[ $@edit:before-readline $&hook ]
}
# ~/.elvish/rc.elv
use direnv
direnv:setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment