1

Add automatic aliasing of 'rm' for root sessions

This commit is contained in:
Jessie Hildebrandt 2021-03-29 14:28:04 -04:00
parent d9c03bd976
commit 378445e3c9

View File

@ -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 #
##################### #####################