Streamlines Fish init commands

• Replace multi-option SSH function with a simplified alias
• Correct rm command error message from "trashy" to "trash"
• Organize function sections and update completions
This commit is contained in:
Chris Toph 2025-04-22 15:03:50 -04:00
parent dfcf666a78
commit dc8ea6f5a9

View file

@ -1,3 +1,7 @@
set fish_greeting # Disable greeting
## Aliases and Overrides ##
function cd function cd
zoxide $argv zoxide $argv
end end
@ -6,58 +10,23 @@ function ls
eza $argv eza $argv
end end
function s
ssh $argv
end
# Copy competitions
complete -c ls --wraps eza
complete -c ls --wraps eza
complete -c s --wraps ssh
# Discourage using rm command # Discourage using rm command
function rm function rm
if test (count $argv) -gt 0 if test (count $argv) -gt 0
echo "Error: 'rm' is protected. Please use 'trashy' command instead." echo "Error: 'rm' is protected. Please use 'trash' command instead."
end end
end end
# SSH function, just for convenience since I use it a lot ## Functions and tools ##
function s
set user (whoami)
set keyfile ""
set host ""
set args $argv
while test (count $args) -gt 0
switch $args[1]
case -u
if test (count $args) -ge 2
set user $args[2]
set args $args[3..-1]
else
echo "Error: Option -u requires a username argument."
echo "Usage: s [-u username] [-i keyfile] host"
return 1
end
case -i
if test (count $args) -ge 2
set keyfile $args[2]
set args $args[3..-1]
else
echo "Error: Option -i requires a keyfile argument."
echo "Usage: s [-u username] [-i keyfile] host"
return 1
end
case '*'
set host $args[1]
set args $args[2..-1]
end
end
if test -z "$host"
echo "Error: Missing host."
echo "Usage: s [-u username] [-i keyfile] host"
return 1
end
if test -n "$keyfile"
ssh -i $keyfile $user@$host
else
ssh $user@$host
end
end
function zipz function zipz
# Ensure exactly two arguments are provided # Ensure exactly two arguments are provided
@ -144,6 +113,6 @@ function unzipz
end end
end end
set fish_greeting # Disable greeting ## Fish Prompt ##
fastfetch fastfetch