mirror of
				https://github.com/tmux-plugins/tmux-sensible.git
				synced 2025-11-04 00:16:03 +00:00 
			
		
		
		
	Merge pull request #62 from setsevireon/patch-1
XDG-friendly config reload
This commit is contained in:
		@@ -64,6 +64,15 @@ key_binding_not_changed() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					get_tmux_config() {
 | 
				
			||||||
 | 
						local tmux_config_xdg="${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
 | 
				
			||||||
 | 
						local tmux_config="$HOME/.tmux.conf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						[[ -f "${tmux_config_xdg}" ]] && tmux_config=${tmux_config_xdg}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						echo ${tmux_config}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main() {
 | 
					main() {
 | 
				
			||||||
	# OPTIONS
 | 
						# OPTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -147,9 +156,11 @@ main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# source `.tmux.conf` file - as suggested in `man tmux`
 | 
						# source `.tmux.conf` file - as suggested in `man tmux`
 | 
				
			||||||
	if key_binding_not_set "R"; then
 | 
						if key_binding_not_set "R"; then
 | 
				
			||||||
		tmux bind-key R run-shell ' \
 | 
							local tmux_config=$(get_tmux_config)
 | 
				
			||||||
			tmux source-file ~/.tmux.conf > /dev/null; \
 | 
					
 | 
				
			||||||
			tmux display-message "Sourced .tmux.conf!"'
 | 
							tmux bind-key R run-shell " \
 | 
				
			||||||
 | 
								tmux source-file ${tmux_config} > /dev/null; \
 | 
				
			||||||
 | 
								tmux display-message 'Sourced ${tmux_config}!'"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
main
 | 
					main
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user