Add automatic aliasing of 'rm' for root sessions
This commit is contained in:
		
							parent
							
								
									d9c03bd976
								
							
						
					
					
						commit
						378445e3c9
					
				
							
								
								
									
										17
									
								
								config.fish
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								config.fish
									
									
									
									
									
								
							@ -16,10 +16,12 @@
 | 
				
			|||||||
#  * Dynamic prompt character (root/user, return status)
 | 
					#  * Dynamic prompt character (root/user, return status)
 | 
				
			||||||
#  * Dynamic greeting function
 | 
					#  * Dynamic greeting function
 | 
				
			||||||
#  * Optional timestamps
 | 
					#  * Optional timestamps
 | 
				
			||||||
 | 
					#  * Automatic aliasing of 'rm' -> 'rm -i' for root sessions
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Configurable variables:
 | 
					# Configurable variables:
 | 
				
			||||||
#  * __fish_prompt_show_timestamps - If set, displays timestamps on the right side of the terminal
 | 
					#  * __fish_prompt_show_timestamps - If set, displays timestamps on the right side of the terminal
 | 
				
			||||||
#  * __fish_greeting_fortune_cookies - Overrides the default list of fortune cookies to use for greetings
 | 
					#  * __fish_greeting_fortune_cookies - Overrides the default list of fortune cookies to use for greetings
 | 
				
			||||||
 | 
					#  * __fish_disable_interactive_root_rm - If set, disables automatic aliasing of 'rm' to 'rm -i' when signed in as root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#####################
 | 
					#####################
 | 
				
			||||||
# Setting Variables #
 | 
					# Setting Variables #
 | 
				
			||||||
@ -33,6 +35,21 @@ set fish_color_command 8787ff
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
set VIRTUAL_ENV_DISABLE_PROMPT true
 | 
					set VIRTUAL_ENV_DISABLE_PROMPT true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###########
 | 
				
			||||||
 | 
					# Aliases #
 | 
				
			||||||
 | 
					###########
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Conditionally set 'rm' -> 'rm -i' alias for the root user only
 | 
				
			||||||
 | 
					switch (id -u)
 | 
				
			||||||
 | 
					    case 0
 | 
				
			||||||
 | 
					        # Root
 | 
				
			||||||
 | 
					        if not set -q __fish_disable_interactive_root_rm
 | 
				
			||||||
 | 
					            alias rm 'rm -i'
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					    case '*'
 | 
				
			||||||
 | 
					        # Everyone else
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#####################
 | 
					#####################
 | 
				
			||||||
# Greeting Function #
 | 
					# Greeting Function #
 | 
				
			||||||
#####################
 | 
					#####################
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user