Browse Source

Fix powershell profile paths in readme (#990)

fixes #969

Co-authored by: Mike Schweitzer <mschweitzer@gmail.com>
remotes/origin/list-filter
Gal Schlezinger 2 years ago committed by GitHub
parent
commit
30deaf96e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      README.md

11
README.md

@ -105,6 +105,7 @@ Then, [set up your shell for fnm](#shell-setup) @@ -105,6 +105,7 @@ Then, [set up your shell for fnm](#shell-setup)
- [Set up your shell for fnm](#shell-setup)
### Removing
To remove fnm (😢), just delete the `.fnm` folder in your home directory. You should also edit your shell configuration to remove any references to fnm (ie. read [Shell Setup](#shell-setup), and do the opposite).
## Completions
@ -131,6 +132,7 @@ This is done by evaluating the output of `fnm env`. @@ -131,6 +132,7 @@ This is done by evaluating the output of `fnm env`.
To automatically run `fnm use` when a directory contains a `.node-version` or `.nvmrc` file, add the `--use-on-cd` option to your shell setup.
Adding a `.node-version` to your project is as simple as:
```bash
$ node --version
v14.18.3
@ -171,8 +173,10 @@ Add the following to the end of your profile file: @@ -171,8 +173,10 @@ Add the following to the end of your profile file:
fnm env --use-on-cd | Out-String | Invoke-Expression
```
- On Windows, the profile is located at `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` or `$PROFILE`
- For macOS/Linux, the profile is located at `~/.config/powershell/Microsoft.PowerShell_profile.ps1`
- On Windows, PowerShell comes pre-installed, but there are two versions of it. [Read more about it here](https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell). The profile is located at different places depending on which version you're using:
- Built in PowerShell (aka "Windows PowerShell"): `~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1`
- The newer, PowerShell >= 7, that's not built in: `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`
#### Windows Command Prompt aka Batch aka WinCMD
@ -181,6 +185,7 @@ fnm is also supported but is not entirely covered. [You can set up a startup scr @@ -181,6 +185,7 @@ fnm is also supported but is not entirely covered. [You can set up a startup scr
```batch
FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i
```
If you get the error `i was unexpected at this time`, please make a .cmd file as suggested by the first step in the Usage with Cmder secton add it's path to the `AutoRun` registry key.
#### Usage with Cmder
@ -189,16 +194,20 @@ Usage is very similar to the normal WinCMD install, apart for a few tweaks to al @@ -189,16 +194,20 @@ Usage is very similar to the normal WinCMD install, apart for a few tweaks to al
Then you can do something like this:
- Make a .cmd file to invoke it
```batch
:: %CMDER_ROOT%\bin\fnm_init.cmd
@echo off
FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z
```
- Add it to the startup script
```batch
:: %CMDER_ROOT%\config\user_profile.cmd
call "%CMDER_ROOT%\bin\fnm_init.cmd"
```
You can replace `%CMDER_ROOT%` with any other convenient path too.
## [Usage](./docs/commands.md)

Loading…
Cancel
Save