addet some aliases?

This commit is contained in:
pika 2024-07-30 19:17:00 +02:00
parent 45f4c0aa3a
commit 0f3d2cd489
3 changed files with 88 additions and 45 deletions

View file

@ -56,9 +56,9 @@ end
# ─< colorized ls >─────────────────────────────────────────────────────────────────────────
# ─< lsd >──────────────────────────────────────────────────────────────────────────────────
if command -v lsd >/dev/null 2>&1
alias ls="lsd --long --git"
alias l="lsd -1 --almost-all"
alias ll="lsd -lA"
alias ls="lsd -l -1 -h1 --almost-all --git"
alias l="lsd -1"
alias ll="lsd -1 --almost-all"
alias clearl="command clear && l"
alias tree="lsd --tree"
else
@ -77,9 +77,9 @@ else
alias tree="eza --icons -l -tree"
else
# ─< if nothing works -- plain old ls >─────────────────────────────────────────────────────
alias ls="ls --color=always -lph"
alias l="ls --color=always -lph"
alias ll="ls --color=always -lAph"
alias ls="ls --color=always -lAph"
alias l="ls --color=always -lph -w1"
alias ll="ls --color=always -lph"
end
end
end
@ -108,8 +108,40 @@ if command -v telnet >/dev/null 2>&1
end
# ─< rsync >────────────────────────────────────────────────────────────────────────────────
function _rsync
# Check if the 'find' command exists
if command -v find >/dev/null 2>&1
# Initialize the number of files to 0
set numbers 0
# Loop through all arguments except the last one (which is the destination)
for source in $argv[1..-2]
# Count the number of files in the source directory
set numbers (math $numbers + (find $source -type f | wc -l))
end
# Set the destination (last argument)
set destination $argv[-1]
# Set the color to magenta
set_color magenta
# Use rsync with pv for progress
rsync -avP --info=progress2 $argv[1..-2] $destination | pv -lpes $numbers
# Reset the color to normal
set_color normal
else
# If 'find' is not installed, display a warning message
echo "We could not find 'find'. Please install 'find' to enable the progress bar. (hit 'CTRL + C' to exit now)"
sleep 5
# Run rsync without progress bar
rsync -avP --info=progress2 $argv
end
end
if command -v rsync >/dev/null 2>&1
alias cp="rsync -avP --info=progress2"
alias cp="_rsync"
alias scp="rsync -avP"
end

View file

@ -1,7 +1,13 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR FISH_INSTALL:yay\x20install\x20\x2d\x2dnoconfirm
SETUVAR __fish_initialized:3400
SETUVAR _fisher_jorgebucaran_2F_autopair_2E_fish_files:\x7e/\x2econfig/fish/functions/_autopair_backspace\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_left\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_right\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_same\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_tab\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/autopair\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_patrickf1_2F_colored__man__pages_2E_fish_files:\x7e/\x2econfig/fish/functions/cless\x2efish\x1e\x7e/\x2econfig/fish/functions/man\x2efish
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/autopair\x2efish\x1epatrickf1/fzf\x2efish\x1epatrickf1/colored_man_pages\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:005fd7

View file

@ -2,11 +2,11 @@
function upin
# ─< check for sudo/root >──────────────────────────────────────────────────────────────────
if [ $USER = "root" ]
if [ $USER = root ]
set su ""
else
if command -v sudo >/dev/null 2>&1
set su "sudo"
set su sudo
end
end
@ -43,7 +43,7 @@ function upin
# ─< Pacman - Arch >────────────────────────────────────────────────────
if command -v paru >/dev/null 2>&1
set pkg "paru"
set pkg paru
set install "$pkg -S"
set update "$pkg -Syu"
set search "$pkg -Ss"
@ -51,7 +51,7 @@ function upin
set unattendet "$pkg install --noconfirm"
else
if command -v yay >/dev/null 2>&1
set pkg "yay"
set pkg yay
set install "$pkg -S"
set update "$pkg -Syu"
set search "$pkg -Ss"
@ -93,7 +93,7 @@ function upin
set -U FISH_INSTALL $install
end
if test -n "$install"
set vars "install" "update" "search" "remove"
set vars install update search remove
for env in $vars
if not test -z "$env"
alias "$env"="$$env"
@ -125,7 +125,7 @@ function gsa
echo "-- enter the repository to add as a submodule --"
echo "-- (type 'quit' to quit) --"
read repo
if [ "$repo" = "quit" ]
if [ "$repo" = quit ]
exit 1
end
@ -134,7 +134,7 @@ function gsa
echo "-- enter the relative path, where the submodule will be cloned to. (!! do it like this: ./path/to/clone/to) --"
echo "-- (type 'quit' to quit) --"
read -S path
if [ "$path" = "quit" ]
if [ "$path" = quit ]
exit 1
end
@ -142,14 +142,14 @@ function gsa
echo "-- enter the branch to checkout (main/master..) --"
echo "-- (type 'quit' to quit) --"
read branch
if [ "$branch" = "quit" ]
if [ "$branch" = quit ]
exit 1
end
echo "-- enter a name for the submodule --"
echo "-- (type 'quit' to quit) --"
read -l name
if [ "$name" = "quit" ]
if [ "$name" = quit ]
exit 1
end
@ -161,22 +161,28 @@ function gsa
# ─< Switch statement to handle the user's confirmation input >─────────────────────────────
switch $comm
# ─< If the user inputs 'y' or 'Y', execute the git submodule add command >─────────────────
case 'y' 'Y'
git submodule add --branch $branch --name $name $repo $path
git submodule update --init --recursive
git add .
git commit -m "Addet $name as a submodule"
git push
case y Y
git submodule add --branch $branch --name $name $repo $path
git submodule update --init --recursive
git add .
git commit -m "Addet $name as a submodule"
git push
# ─< If the user inputs 'n' or 'N', notify them to try again >──────────────────────────────
case 'n' 'N'
echo "-- all right, just try again :) --"
# ─< If the user inputs 'n' or 'N', notify them to try again >──────────────────────────────
case n N
echo "-- all right, just try again :) --"
end
end
# ╭───────────────────────────────────────────────────╮
# │ FUNCTION: set tmux command to always work with ta │
# ╰───────────────────────────────────────────────────╯
# ╭────────────────────────────────────╮
# │ FUNCTION: ssh-agent initialisation │
# ╰────────────────────────────────────╯
set -x SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket
# ╭───────────────────────────────────────────────────╮
# │ FUNCTION: set tmux command to always work with ta │
# ╰───────────────────────────────────────────────────╯
if command -v tmux >/dev/null 2>&1
set tmux_y "tmux-session active!"
@ -184,20 +190,20 @@ if command -v tmux >/dev/null 2>&1
function ta
command tmux list-sessions >/dev/null 2>&1
switch $status
case 0
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_y"
end
echo "$tmux_y"
sleep 0.5
tmux a
case '*'
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_n"
end
echo "No Tmux session found. Creating one now! --"
sleep 0.5
tmux
case 0
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_y"
end
echo "$tmux_y"
sleep 0.5
tmux a
case '*'
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_n"
end
echo "No Tmux session found. Creating one now! --"
sleep 0.5
tmux
end
end
end
@ -208,7 +214,7 @@ end
function dep_fisher
# ─< Define dependencies for the plugins used by fisher >───────────────────────────────────
set dependencies "fzf" "btop" "fastfetch" "curl" "wget" "cmatrix"
set dependencies fzf btop fastfetch curl wget cmatrix
# ─< Check and install dependencies >───────────────────────────────────────────────────────
for dep in $dependencies
if not command -v $dep >/dev/null 2>&1
@ -232,8 +238,7 @@ function check_fishr
fisher update
else
if test ! -e $HOME/.config/fish/functions/fisher.fish
echo "you did it!!"> $HOME/.config/fish/.fishr.init && curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source & fisher install jorgebucaran/fisher
echo "you did it!!" >$HOME/.config/fish/.fishr.init && curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source & fisher install jorgebucaran/fisher
end
end
end