# - bof - #



<<'comment'
# - Configured - #

rm -rf ~/.bashrc;
nvim ~/.bashrc;

rm -rf ~/.zshrc;
nvim ~/.zshrc;

ssh-keygen -R 192.168.1.1

# - On client - #
cd ~/.ssh;
ssh-keygen -t rsa;

cat ~/.ssh/id_rsa.pub;

# - On server - #
nvim ~/.ssh/authorized_keys;

sudo apt install curl git htop inxi net-tools ntp neovim screenfetch tree -y;
comment



# Oh-my-zsh installation path
ZSH=/usr/share/oh-my-zsh/

# Powerlevel10k theme path
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme

# List of plugins used
plugins=( git sudo zsh-256color zsh-autosuggestions zsh-syntax-highlighting )
source $ZSH/oh-my-zsh.sh

# In case a command is not found, try to find the package that has it
function command_not_found_handler {
    local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
    printf 'zsh: command not found: %s\n' "$1"
    local entries=( ${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"} )
    if (( ${#entries[@]} )) ; then
        printf "${bright}$1${reset} may be found in the following packages:\n"
        local pkg
        for entry in "${entries[@]}" ; do
            local fields=( ${(0)entry} )
            if [[ "$pkg" != "${fields[2]}" ]]; then
                printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
            fi
            printf '    /%s\n' "${fields[4]}"
            pkg="${fields[2]}"
        done
    fi
    return 127
}

# Detect AUR wrapper
if pacman -Qi yay &>/dev/null; then
   aurhelper="yay"
elif pacman -Qi paru &>/dev/null; then
   aurhelper="paru"
fi

function in {
    local -a inPkg=("$@")
    local -a arch=()
    local -a aur=()

    for pkg in "${inPkg[@]}"; do
        if pacman -Si "${pkg}" &>/dev/null; then
            arch+=("${pkg}")
        else
            aur+=("${pkg}")
        fi
    done

    if [[ ${#arch[@]} -gt 0 ]]; then
        sudo pacman -S "${arch[@]}"
    fi

    if [[ ${#aur[@]} -gt 0 ]]; then
        ${aurhelper} -S "${aur[@]}"
    fi
}

# Helpful aliases
alias c='clear' # clear terminal
alias l='eza -lh --icons=auto' # long list
alias ls='eza -1 --icons=auto' # short list
alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
alias ld='eza -lhD --icons=auto' # long list dirs
alias lt='eza --icons=auto --tree' # list folder as tree
alias un='$aurhelper -Rns' # uninstall package
alias up='$aurhelper -Syu' # update system/package/aur
alias pl='$aurhelper -Qs' # list installed package
alias pa='$aurhelper -Ss' # list available package
alias pc='$aurhelper -Sc' # remove unused cache
alias po='$aurhelper -Qtdq | $aurhelper -Rns -' # remove unused packages, also try > $aurhelper -Qqd | $aurhelper -Rsu --print -
alias vc='code' # gui code editor

#alias l='ls -hF'
#alias ll='ls -lhF --group-directories-first'
alias lm='ll |more'         #  Pipe through more
alias lr='ls -Rh'           #  Recursive ls.
alias lA='ls -Ah'           #  Show hidden files.
alias la='ls -lahF --icons=auto'
alias lsa='eza -ah'
#alias alF='eza -alFh'
alias lhA='eza -lhA'
alias Alh='ls -Alh --group-directories-first --color=auto --'
alias v='nvim'
alias vim='nvim'

alias tree='tree -Csuh'    #  Nice alternative to recursive ls ...

# some commands aliases corrections.

alias cd..='cd ..'         #  This one will change to your parent directory, even when you forget the space.
alias ..='cd ..'           #  You can also cut out the cd part entirely by making an alias for ..
alias ...='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
alias .6='cd ../../../../../..'
alias .7='cd ../../../../../../..'

alias isWebServer='ssh www.isdevelopment.us' 
alias sshP='ssh 192.168.1.15'
alias sshMini='ssh 192.168.1.16'
alias uSP='ssh 192.168.1.100'
alias uSH='ssh 192.168.1.101'
alias HPLaptopArch='ssh 192.168.1.102'
alias uKasm='ssh 192.168.1.103'
alias HPDesktopArch='ssh 192.168.1.104'
alias uEducation='ssh 192.168.1.105'
alias uMySQL='ssh 192.168.1.110'
alias plex='ssh 192.168.1.115'
alias uPostgreSQL='ssh 192.168.1.120'
alias aMovies='ssh 192.168.1.127'
alias uSSH='ssh 192.168.1.130'
alias uDownload='ssh 192.168.1.140'
alias u150='ssh 192.168.1.150'
alias uDocker='ssh 192.168.1.170'
alias uProxmoxWebServer='ssh 192.168.1.180'
alias uProxy='ssh 192.168.1.194'

#  This one will list our disk usage in human-readable units including filesystem type, and print a total at the bottom
alias df='df -Tha --total'

#  We might as well add an alias for our preferred du output as well:
alias du='du -ach | sort -h'

#  Let's keep going in the same direction by making our free output more human friendly:
alias free='free -mt'

#  We can do a lot with our listing process table. Let's start out by setting a default output:
alias ps='ps auxf'

alias mkdir='mkdir -pv';
alias md='mkdir';
alias rm='rm -rf';
alias cls='clear';
alias lb='lsblk -f;';
alias fs='cat /etc/fstab;';
alias efs='sudo nvim /etc/fstab;';
alias ssn='sudo shutdown now';
alias srn='sudo reboot now';
alias ipa='ip -c address;';
alias ping='ping -c 3';
alias sm='sudo mount -av';

alias update='sudo pacman -Syu --noconfirm && sudo pacman -Syyuu --noconfirm;'

# Always mkdir a path (this doesn't inhibit functionality to make a single dir)
alias mkdir='mkdir -p'

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# Display Pokemon
#pokemon-colorscripts --no-title -r 1,3,6



source <(fzf --zsh)
export EDITOR="nvim"

function y() {
   local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
   yazi "$@" --cwd-file="$tmp"
   if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
      builtin cd -- "$cwd"
   fi
   rm -f -- "$tmp"
}



clear;
if [ "$USER" == "root" ]; then cd ~/; fi;
fastfetch

# -  - #
# - Local & Public IPa - #
echo " Local IPa:" $(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}');
echo "Public IPa:" $(curl -s ifconfig.me);
echo "";


# - eof - #