Skip to content

Instantly share code, notes, and snippets.

@bkono
Forked from thomasritz/direnv.elv
Created March 8, 2018 05:32

Revisions

  1. @thomasritz thomasritz revised this gist Oct 29, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion direnv.elv
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ~/.elvish/lib/direnv.elv
    # ~/.elvish/lib/direnv.elv

    fn hook []{
    env = (or (direnv export json | from-json) [&])
  2. @thomasritz thomasritz created this gist Oct 29, 2017.
    15 changes: 15 additions & 0 deletions direnv.elv
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    ~/.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 ]
    }
    4 changes: 4 additions & 0 deletions rc.elv
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # ~/.elvish/rc.elv

    use direnv
    direnv:setup