Dotfiles/site-modules/core/files/nushell/scripts/path.nu
Ade Attwood c482f7a612 chore(nu): automatically set the node_modules bin dir on cd
When we are moving around the file system I always want to be able to use the
locally installed executables from my node modules.

Sometimes versions of programs like prettier have different outcomes. I always
want to be using the local version rather than the system installed version.
2025-01-21 08:22:40 +00:00

20 lines
474 B
Text

export-env {
$env.GOPATH = $"($env.HOME)/Code"
$env.PATH = $env.PATH
| split row ":"
| prepend ([$env.HOME ".cargo" "bin"] | path join)
| str join ":"
}
export def --env node-modules-dir-hook [dir: string] {
let nodePath = ([$dir, "node_modules", ".bin"] | path join)
if ($nodePath | path exists) {
$env.PATH = $env.PATH
| split row ":"
| where {|x| not ($x | str contains "node_modules")}
| prepend $nodePath
| str join ":"
}
}