mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Use only shell builtins to avoid triggering autojump, instead of needing GNU readlink
Under Zsh, the `-q` flag to `cd` makes it not run `chpwd` hooks and hence makes it not add `~/.nvm` to `autojump`.
This commit is contained in:
		
							
								
								
									
										11
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -7,15 +7,16 @@ | ||||
| # Implemented by Tim Caswell <tim@creationix.com> | ||||
| # with much bash help from Matthew Ranney | ||||
|  | ||||
| # Auto detect the NVM_DIR | ||||
| if [ ! -d "$NVM_DIR" ]; then | ||||
|     export NVM_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]:-$0})) | ||||
| fi | ||||
|  | ||||
| # Make zsh glob matching behave same as bash | ||||
| # This fixes the "zsh: no matches found" errors | ||||
| if [ ! -z "$(which unsetopt 2>/dev/null)" ]; then | ||||
|     unsetopt nomatch 2>/dev/null | ||||
|     NVM_CD_FLAGS="-q" | ||||
| fi | ||||
|  | ||||
| # Auto detect the NVM_DIR | ||||
| if [ ! -d "$NVM_DIR" ]; then | ||||
|     export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd) | ||||
| fi | ||||
|  | ||||
| nvm_set_nullglob() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user