Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 734 Bytes

direnv.md

File metadata and controls

30 lines (23 loc) · 734 Bytes
title
Direnv

Direnv

Many people use direnv to load an environment upon entering a directory as well as unloading it when exiting the directory. Configuring direnv to work with nushell requires nushell version 0.66 or later.


Configuring direnv

To make direnv work with nushell the way it does with other shells requires us to use the hooks functionality in nushell:

let-env config = {
  hooks: {
    pre_prompt: [{
      code: "
        let direnv = (direnv export json | from json)
        let direnv = if ($direnv | length) == 1 { $direnv } else { {} }
        $direnv | load-env
      "
    }]
  }
}

With that configuration in place, direnv should now work with nushell.