mirror of
				https://github.com/tmux-plugins/tpm.git
				synced 2025-11-04 08:36:05 +00:00 
			
		
		
		
	Merge pull request #177 from Ambroisie/detect-xdg-config
Use XDG-compatible plugin path when available
This commit is contained in:
		@@ -1,6 +1,8 @@
 | 
				
			|||||||
# Changing plugins install dir
 | 
					# Changing plugins install dir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
By default, TPM installs plugins to `~/.tmux/plugins/`.
 | 
					By default, TPM installs plugins in a subfolder named `plugins/` inside
 | 
				
			||||||
 | 
					`$XDG_CONFIG_HOME/tmux/` if a `tmux.conf` file was found at that location, or
 | 
				
			||||||
 | 
					inside `~/.tmux/` otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can change the install path by putting this in `.tmux.conf`:
 | 
					You can change the install path by putting this in `.tmux.conf`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tpm
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tpm
									
									
									
									
									
								
							@@ -21,8 +21,17 @@ tpm_path_set() {
 | 
				
			|||||||
	tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1
 | 
						tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Check if configuration file exists at an XDG-compatible location, if so use
 | 
				
			||||||
 | 
					# that directory for TMUX_PLUGIN_MANAGER_PATH. Otherwise use $DEFAULT_TPM_PATH.
 | 
				
			||||||
set_default_tpm_path() {
 | 
					set_default_tpm_path() {
 | 
				
			||||||
	tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$DEFAULT_TPM_PATH"
 | 
						local xdg_tmux_path="${XDG_CONFIG_HOME:-$HOME/.config}/tmux"
 | 
				
			||||||
 | 
						local tpm_path="$DEFAULT_TPM_PATH"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if [ -f "$xdg_tmux_path/tmux.conf" ]; then
 | 
				
			||||||
 | 
							tpm_path="$xdg_tmux_path/plugins/"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$tpm_path"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
 | 
					# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user