From bbdafdd8540a712cfcdb598aae09c21e1175a7c3 Mon Sep 17 00:00:00 2001 From: Anthony Oteri Date: Tue, 3 Oct 2023 14:10:02 -0400 Subject: [PATCH] Update fish settings --- .config/fish/config.fish | 130 +++++++++++++++++++++++++++++++++++++++ .fish_profile | 15 +++-- 2 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 .config/fish/config.fish diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..b4c98f6 --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,130 @@ +# Hide welcome message & ensure we are reporting fish as shell +set fish_greeting +set VIRTUAL_ENV_DISABLE_PROMPT "1" +set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" +set -x SHELL /usr/bin/fish + +# Environment setup +# Apply .profile: use this to put fish compatible .profile stuff in +if test -f ~/.fish_profile + source ~/.fish_profile +end + +# Add ~/.local/bin to PATH +if test -d ~/.local/bin + if not contains -- ~/.local/bin $PATH + set -p PATH ~/.local/bin + end +end + +# Starship prompt +if status is-interactive + source ("/usr/bin/starship" init fish --print-full-init | psub) +end + +# Advanced command-not-found hook +source /usr/share/doc/find-the-command/ftc.fish + +## Functions +# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang +function __history_previous_command + switch (commandline -t) + case "!" + commandline -t $history[1]; commandline -f repaint + case "*" + commandline -i ! + end +end + +function __history_previous_command_arguments + switch (commandline -t) + case "!" + commandline -t "" + commandline -f history-token-search-backward + case "*" + commandline -i '$' + end +end + +# Fish command history +function history + builtin history --show-time='%F %T ' +end + +function backup --argument filename + cp $filename $filename.bak +end + +# Cleanup local orphaned packages +function cleanup + while pacman -Qdtq + sudo pacman -R (pacman -Qdtq) + end +end + +# Replace ls with eza +alias ls 'eza -al --color=always --group-directories-first --icons' # preferred listing +alias la 'eza -a --color=always --group-directories-first --icons' # all files and dirs +alias ll 'eza -l --color=always --group-directories-first --icons' # long format +alias lt 'eza -aT --color=always --group-directories-first --icons' # tree listing +alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles + +# Replace some more things with better alternatives +alias cat 'bat --style header --style snip --style changes --style header' +if not test -x /usr/bin/yay; and test -x /usr/bin/paru + alias yay 'paru' +end + + +# Common use +alias .. 'cd ..' +alias ... 'cd ../..' +alias .... 'cd ../../..' +alias ..... 'cd ../../../..' +alias ...... 'cd ../../../../..' +alias big 'expac -H M "%m\t%n" | sort -h | nl' # Sort installed packages according to size in MB (expac must be installed) +alias dir 'dir --color=auto' +alias egrep 'grep -E --color=auto' +alias fgrep 'grep -F --color=auto' +alias fixpacman 'sudo rm /var/lib/pacman/db.lck' +alias gitpkg 'pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages +alias grep 'grep --color=auto' +alias grubup 'sudo update-grub' +alias hw 'hwinfo --short' # Hardware Info +alias ip 'ip -color' +alias psmem 'ps auxf | sort -nr -k 4' +alias psmem10 'ps auxf | sort -nr -k 4 | head -10' +alias rmpkg 'sudo pacman -Rdd' +alias tarnow 'tar -acf ' +alias untar 'tar -zxvf ' +alias upd '/usr/bin/garuda-update' +alias vdir 'vdir --color=auto' +alias wget 'wget -c ' + +# Get fastest mirrors +alias mirror 'sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist' +alias mirrora 'sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist' +alias mirrord 'sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist' +alias mirrors 'sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist' + +# Help people new to Arch +alias apt 'man pacman' +alias apt-get 'man pacman' +alias please 'sudo' +alias tb 'nc termbin.com 9999' +alias helpme 'echo "To print basic information about a command use tldr "' +alias pacdiff 'sudo -H DIFFPROG=meld pacdiff' + +# Get the error messages from journalctl +alias jctl 'journalctl -p 3 -xb' + +# Recent installed packages +alias rip 'expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl' + +## Run fastfetch if session is interactive +if status --is-interactive && type -q fastfetch + fastfetch --load-config neofetch +end + + + diff --git a/.fish_profile b/.fish_profile index 98c7607..7401d0a 100644 --- a/.fish_profile +++ b/.fish_profile @@ -1,16 +1,19 @@ set -gx GPG_TTY (tty) -alias k='/usr/bin/kubectl --kubeconfig $HOME/.kube/config' -alias k3='/usr/bin/kubectl --kubeconfig $HOME/.kube/config-k3s' +set -x BAT_CONFIG_PATH $HOME/.config/bat/config.conf + alias vim=/usr/bin/nvim alias vimdiff='/usr/bin/nvim -d' alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' -# Edgeware Specific Environment -alias docker-run=$HOME/workspace/monorepo/docker.sh -#set -x PIP_INDEX_URL https://pypi.edgeware.tv/simple/ -set -x MONOREPO_ROOT $HOME/workspace/monorepo +set -x EDITOR /usr/bin/nvim set -x AWS_PROFILE streampilot-dev +if test -d ~/.cargo/bin + if not contains -- ~/.cargo/bin $PATH + set -p PATH ~/.cargo/bin + end +end + # Faster Docker Builds set -x DOCKER_BUILDKIT 1