Changed . token to _dot

This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
This commit is contained in:
2024-11-07 13:52:17 +00:00
parent 83b02bd753
commit 896af887ca
2351 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
# Fast Node Manager (fnm)
Enables Nushell support for [Fast Node Manager (fnm)](https://github.com/Schniz/fnm), a fast and simple Node.js version manager. Based on [this GitHub issue](https://github.com/Schniz/fnm/issues/463) and [fnm-nushell](https://github.com/Southclaws/fnm-nushell).
Requires `fnm` to be installed separately.
## Install
Clone this repo or copy the `fnm.nu` file wherever your prefer to keep your Nushell scripts.
Edit your Nushell config file (`$nu.config-path`) and add the line:
```nu
use /path/to/fnm.nu
```

View File

@@ -0,0 +1,39 @@
export-env {
def fnm-env [] {
mut env_vars = {}
let pwsh_vars = (
^fnm env --shell power-shell |
lines |
parse "$env:{key} = \"{value}\""
)
# fnm-prefixed vars
for v in ($pwsh_vars | range 1..) {
$env_vars = ($env_vars | insert $v.key $v.value)
}
# path
let env_used_path = ($env | columns | where {str downcase | $in == "path"} | get 0)
let path_value = ($pwsh_vars | get 0.value | split row (char esep))
$env_vars = ($env_vars | insert $env_used_path $path_value)
return $env_vars
}
if not (which fnm | is-empty) {
fnm-env | load-env
if (not ($env | default false __fnm_hooked | get __fnm_hooked)) {
$env.__fnm_hooked = true
$env.config = ($env | default {} config).config
$env.config = ($env.config | default {} hooks)
$env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
$env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
$env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append { |before, after|
if ('FNM_DIR' in $env) and ([.nvmrc .node-version] | path exists | any { |it| $it }) {
(^fnm use); (fnm-env | load-env)
}
}))
}
}
}