mirror of
https://github.com/ivuorinen/nvm-auto-use.fish.git
synced 2026-02-28 18:56:13 +00:00
feat: multiple improvements, additions, vibin'
This commit is contained in:
121
README.md
121
README.md
@@ -1,6 +1,7 @@
|
||||
# nvm-auto-use.fish
|
||||
|
||||
Automates loading the correct Node.js version from `.nvmrc` in Fish shell.
|
||||
Intelligent Node.js version management for Fish shell with automatic version switching, multi-manager support,
|
||||
and extensive configuration options.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -10,18 +11,122 @@ Ensure you have [fisher](https://github.com/jorgebucaran/fisher) installed, then
|
||||
fisher install ivuorinen/nvm-auto-use.fish
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Features
|
||||
|
||||
This script automatically detects the `.nvmrc` file in your current or
|
||||
parent directories and loads the specified Node.js version.
|
||||
### 🚀 **Automatic Version Switching**
|
||||
|
||||
If the specified version is not installed, it will be installed
|
||||
automatically using `nvm install`.
|
||||
- Detects Node.js version files when changing directories
|
||||
- Supports multiple file formats: `.nvmrc`, `.node-version`, `.tool-versions`, `package.json` engines.node
|
||||
- Handles version aliases: `lts`, `latest`, `stable`, `node`
|
||||
- Automatic version installation when missing
|
||||
|
||||
### ⚡ **Performance & UX**
|
||||
|
||||
- **Smart caching** - Avoids redundant file reads and version switches
|
||||
- **Debouncing** - Prevents rapid switching during quick navigation
|
||||
- **Silent mode** - Suppress output messages
|
||||
- **Visual indicators** - Display current Node.js version in prompt
|
||||
|
||||
### 🔧 **Multi-Manager Compatibility**
|
||||
|
||||
- **nvm** - Node Version Manager
|
||||
- **fnm** - Fast Node Manager
|
||||
- **volta** - JavaScript toolchain manager
|
||||
- **asdf** - Extendable version manager
|
||||
|
||||
### ⚙️ **Extensive Configuration**
|
||||
|
||||
- Toggle automatic installation
|
||||
- Directory exclusion patterns
|
||||
- Configurable debounce timing
|
||||
- Manager preference selection
|
||||
- Project-only activation mode
|
||||
|
||||
### 🔔 **Developer Tools**
|
||||
|
||||
- Desktop notifications for version switches
|
||||
- Environment variable export (`NODE_VERSION`)
|
||||
- Fish shell completions
|
||||
- Detailed status reporting
|
||||
|
||||
## Quick Start
|
||||
|
||||
After installation, the plugin works automatically! Simply navigate to any directory with a Node.js version file:
|
||||
|
||||
```fish
|
||||
# Create a project with specific Node version
|
||||
echo "18.17.0" > .nvmrc
|
||||
cd . # Automatically switches to Node.js v18.17.0
|
||||
|
||||
# Works with package.json too
|
||||
echo '{"engines": {"node": ">=16.0.0"}}' > package.json
|
||||
cd . # Switches to compatible Node.js version
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Customize the plugin behavior with `nvm_auto_use_config`:
|
||||
|
||||
```fish
|
||||
# View current settings
|
||||
nvm_auto_use_config
|
||||
|
||||
# Enable silent mode
|
||||
nvm_auto_use_config silent on
|
||||
|
||||
# Disable automatic installation
|
||||
nvm_auto_use_config auto_install off
|
||||
|
||||
# Set preferred version manager
|
||||
nvm_auto_use_config manager fnm
|
||||
|
||||
# Adjust debounce timing (milliseconds)
|
||||
nvm_auto_use_config debounce 1000
|
||||
|
||||
# Exclude directories
|
||||
nvm_auto_use_config exclude "build"
|
||||
nvm_auto_use_config exclude "dist"
|
||||
|
||||
# Reset all settings
|
||||
nvm_auto_use_config reset
|
||||
```
|
||||
|
||||
## Supported File Formats
|
||||
|
||||
| File | Format | Example |
|
||||
|------|--------|---------|
|
||||
| `.nvmrc` | Plain version | `18.17.0` or `lts/hydrogen` |
|
||||
| `.node-version` | Plain version | `18.17.0` |
|
||||
| `.tool-versions` | Tool + version | `nodejs 18.17.0` |
|
||||
| `package.json` | engines.node field | `"engines": {"node": ">=16.0.0"}` |
|
||||
|
||||
## Utility Functions
|
||||
|
||||
```fish
|
||||
# Check current Node.js status
|
||||
nvm_version_status
|
||||
|
||||
# Get version for prompt integration
|
||||
nvm_version_prompt # Returns: ⬢ 18.17.0
|
||||
|
||||
# Control silent mode
|
||||
nvm_auto_use_silent on/off
|
||||
|
||||
# Detect available version managers
|
||||
nvm_compat_detect
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Fish shell 3.0+
|
||||
- At least one supported Node.js version manager:
|
||||
- [nvm](https://github.com/nvm-sh/nvm)
|
||||
- [fnm](https://github.com/Schniz/fnm)
|
||||
- [volta](https://volta.sh/)
|
||||
- [asdf](https://asdf-vm.com/) with nodejs plugin
|
||||
|
||||
## Uninstall
|
||||
|
||||
To remove the plugin, run:
|
||||
|
||||
```fish
|
||||
fisher remove ivuorinen/nvm-auto-use.fish
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user