fixed a lot of stuff
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
configs/colors.fish
|
||||||
|
fish_variables
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# This file was created by fish when upgrading to version 4.3, to migrate
|
|
||||||
# the 'fish_key_bindings' variable from its old default scope (universal)
|
|
||||||
# to its new default scope (global). We recommend you delete this file
|
|
||||||
# and configure key bindings in ~/.config/fish/config.fish if needed.
|
|
||||||
|
|
||||||
# set --global fish_key_bindings fish_default_key_bindings
|
|
||||||
|
|
||||||
# Prior to version 4.3, fish shipped an event handler that runs
|
|
||||||
# `set --universal fish_key_bindings fish_default_key_bindings`
|
|
||||||
# whenever the fish_key_bindings variable is erased.
|
|
||||||
# This means that as long as any fish < 4.3 is still running on this system,
|
|
||||||
# we cannot complete the migration.
|
|
||||||
# As a workaround, erase the universal variable at every shell startup.
|
|
||||||
set --erase --universal fish_key_bindings
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
# This file was created by fish when upgrading to version 4.3, to migrate
|
|
||||||
# theme variables from universal to global scope.
|
|
||||||
# Don't edit this file, as it will be written by the web-config tool (`fish_config`).
|
|
||||||
# To customize your theme, delete this file and see
|
|
||||||
# help interactive#syntax-highlighting
|
|
||||||
# or
|
|
||||||
# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING
|
|
||||||
# for appropriate commands to add to ~/.config/fish/config.fish instead.
|
|
||||||
# See also the release notes for fish 4.3.0 (run `help relnotes`).
|
|
||||||
|
|
||||||
set --global fish_color_autosuggestion brblack
|
|
||||||
set --global fish_color_cancel -r
|
|
||||||
set --global fish_color_command blue
|
|
||||||
set --global fish_color_comment red
|
|
||||||
set --global fish_color_cwd green
|
|
||||||
set --global fish_color_cwd_root red
|
|
||||||
set --global fish_color_end green
|
|
||||||
set --global fish_color_error brred
|
|
||||||
set --global fish_color_escape brcyan
|
|
||||||
set --global fish_color_history_current --bold
|
|
||||||
set --global fish_color_host normal
|
|
||||||
set --global fish_color_host_remote yellow
|
|
||||||
set --global fish_color_normal normal
|
|
||||||
set --global fish_color_operator brcyan
|
|
||||||
set --global fish_color_param cyan
|
|
||||||
set --global fish_color_quote yellow
|
|
||||||
set --global fish_color_redirection cyan --bold
|
|
||||||
set --global fish_color_search_match white --background=brblack
|
|
||||||
set --global fish_color_selection white --bold --background=brblack
|
|
||||||
set --global fish_color_status red
|
|
||||||
set --global fish_color_user brgreen
|
|
||||||
set --global fish_color_valid_path --underline
|
|
||||||
set --global fish_pager_color_completion normal
|
|
||||||
set --global fish_pager_color_description yellow -i
|
|
||||||
set --global fish_pager_color_prefix normal --bold --underline
|
|
||||||
set --global fish_pager_color_progress brwhite --background=cyan
|
|
||||||
set --global fish_pager_color_selected_background -r
|
|
||||||
+4
-2
@@ -3,5 +3,7 @@ set -q XDG_DATA_HOME
|
|||||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||||
|
|
||||||
# Load Oh My Fish configuration.
|
# Load Oh My Fish configuration if it exists.
|
||||||
source $OMF_PATH/init.fish
|
if test -f $OMF_PATH/init.fish
|
||||||
|
source $OMF_PATH/init.fish
|
||||||
|
end
|
||||||
|
|||||||
+14
-26
@@ -1,20 +1,19 @@
|
|||||||
# source ~/.config/fish/configs/aliases.fish
|
# Replace frozen key bindings migration (deletes fish_frozen_key_bindings.fish)
|
||||||
|
set --global fish_key_bindings fish_default_key_bindings
|
||||||
# if test -f $HOME/.config/fish/alias.fish ]
|
|
||||||
# source $HOME/.config/fish/alias.fish
|
|
||||||
# end
|
|
||||||
|
|
||||||
set distro (cat /etc/os-release | grep ^ID= | cut -d '=' -f 2 | tr -d '"')
|
|
||||||
|
|
||||||
if status is-interactive
|
if status is-interactive
|
||||||
# Commands to run in interactive sessions can go here
|
# Get distro ID from /etc/os-release
|
||||||
|
if test -f /etc/os-release
|
||||||
|
set -l os_id (string match -r '^ID=.*' </etc/os-release 2>/dev/null | string split -m1 '=' | string lower)
|
||||||
|
set -l distro $os_id[2]
|
||||||
|
else
|
||||||
|
set distro unknown
|
||||||
|
end
|
||||||
|
|
||||||
# Load the theme
|
|
||||||
if test -f $HOME/.config/fish/configs/theme.fish
|
if test -f $HOME/.config/fish/configs/theme.fish
|
||||||
source $HOME/.config/fish/configs/theme.fish
|
source $HOME/.config/fish/configs/theme.fish
|
||||||
end
|
end
|
||||||
|
|
||||||
# Load the aliases
|
|
||||||
if test -f $HOME/.config/fish/configs/alias_custom-script.fish
|
if test -f $HOME/.config/fish/configs/alias_custom-script.fish
|
||||||
source $HOME/.config/fish/configs/alias_custom-script.fish
|
source $HOME/.config/fish/configs/alias_custom-script.fish
|
||||||
end
|
end
|
||||||
@@ -24,29 +23,21 @@ if status is-interactive
|
|||||||
if test -f $HOME/.config/fish/configs/alias_useful.fish
|
if test -f $HOME/.config/fish/configs/alias_useful.fish
|
||||||
source $HOME/.config/fish/configs/alias_useful.fish
|
source $HOME/.config/fish/configs/alias_useful.fish
|
||||||
end
|
end
|
||||||
if test -f $HOME/.config/fish/configs/function_usefull.fish
|
|
||||||
source $HOME/.config/fish/configs/function_usefull.fish
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -f $HOME/.config/fish/configs/env.fish
|
if test -f $HOME/.config/fish/configs/env.fish
|
||||||
source $HOME/.config/fish/configs/env.fish
|
source $HOME/.config/fish/configs/env.fish
|
||||||
end
|
end
|
||||||
|
|
||||||
# ~/.config/fish/config.fish
|
|
||||||
|
|
||||||
# Get the distribution name and version
|
|
||||||
|
|
||||||
|
|
||||||
switch $distro
|
switch $distro
|
||||||
case 'fedora'
|
case fedora
|
||||||
if test -f $HOME/.config/fish/configs/fedora_config.fish
|
if test -f $HOME/.config/fish/configs/fedora_config.fish
|
||||||
source $HOME/.config/fish/configs/fedora_config.fish
|
source $HOME/.config/fish/configs/fedora_config.fish
|
||||||
end
|
end
|
||||||
case 'arch'
|
case arch
|
||||||
if test -f $HOME/.config/fish/configs/arch_config.fish
|
if test -f $HOME/.config/fish/configs/arch_config.fish
|
||||||
source $HOME/.config/fish/configs/arch_config.fish
|
source $HOME/.config/fish/configs/arch_config.fish
|
||||||
end
|
end
|
||||||
case 'ubuntu'
|
case ubuntu
|
||||||
if test -f $HOME/.config/fish/configs/ubuntu_config.fish
|
if test -f $HOME/.config/fish/configs/ubuntu_config.fish
|
||||||
source $HOME/.config/fish/configs/ubuntu_config.fish
|
source $HOME/.config/fish/configs/ubuntu_config.fish
|
||||||
end
|
end
|
||||||
@@ -55,11 +46,8 @@ if status is-interactive
|
|||||||
source $HOME/.config/fish/configs/default_config.fish
|
source $HOME/.config/fish/configs/default_config.fish
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if test -x /usr/bin/fastfetch
|
|
||||||
|
if test -e /usr/bin/fastfetch
|
||||||
fastfetch
|
fastfetch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin $PATH /home/honney/.ghcup/bin # ghcup-env
|
|
||||||
# set -Ux PYENV_ROOT $HOME/.pyenv
|
|
||||||
# fish_add_path $PYENV_ROOT/bin
|
|
||||||
# pyenv init - | source
|
|
||||||
|
|||||||
@@ -3,17 +3,11 @@
|
|||||||
# Fixing some Programs that do not know Kitty or Alacritty
|
# Fixing some Programs that do not know Kitty or Alacritty
|
||||||
|
|
||||||
# Check if the local terminal supports color (kitty, alacritty, etc.)
|
# Check if the local terminal supports color (kitty, alacritty, etc.)
|
||||||
if test "$TERM" = "xterm-kitty" -o "$TERM" = "alacritty"
|
if test "$TERM" = "xterm-kitty"; or test "$TERM" = "alacritty"
|
||||||
# If we're in a non-standard terminal, force TERM=xterm-256color for SSH
|
alias ssh='env TERM=xterm-256color ssh'
|
||||||
alias ssh 'env TERM=xterm-256color ssh'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if test -f $HOME/.config/fish/alias.fish
|
if command -q zoxide
|
||||||
source $HOME/.config/fish/alias.fish
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -e /usr/bin/zoxide
|
|
||||||
eval (zoxide init fish)
|
|
||||||
zoxide init fish | source
|
zoxide init fish | source
|
||||||
alias cd='z'
|
alias cd='z'
|
||||||
end
|
end
|
||||||
|
|||||||
+183
-160
@@ -2,89 +2,122 @@
|
|||||||
# In ~/.config/fish/configs/alias_useful.fish
|
# In ~/.config/fish/configs/alias_useful.fish
|
||||||
#
|
#
|
||||||
|
|
||||||
################# STUFF YOU HAVE INSTALLED #####################################
|
################ COMMON ALIASES ################################################
|
||||||
|
|
||||||
alias remount='sudo mount -a'
|
alias remount='sudo mount -a'
|
||||||
|
|
||||||
alias mount_config='sudo nano /etc/fstab'
|
alias mount_config='sudo nano /etc/fstab'
|
||||||
|
alias own='sudo chown -R "$USER":"$USER"'
|
||||||
alias force_delete='sudo rm -rf' # Delete Folder/Files with included Folder/Files
|
|
||||||
|
|
||||||
alias own='sudo chown -R "$USER":"$USER" themes'
|
|
||||||
alias right='sudo chmod -R 755'
|
alias right='sudo chmod -R 755'
|
||||||
|
|
||||||
alias reload='clear && omf reload'
|
alias reload='clear && omf reload'
|
||||||
|
alias fish_config='nano $HOME/.config/fish/config.fish'
|
||||||
|
alias ip='ip -color'
|
||||||
|
alias psmem='ps auxf | sort -nr -k 4'
|
||||||
|
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
|
||||||
|
alias jctl='journalctl -p 3 -xb'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
alias .....='cd ../../../..'
|
||||||
|
alias ......='cd ../../../../..'
|
||||||
|
alias dir='dir --color=auto'
|
||||||
|
alias vdir='vdir --color=auto'
|
||||||
|
alias tarnow='tar -acf'
|
||||||
|
alias untar='tar -zxvf'
|
||||||
|
|
||||||
alias fish_config='nano $HOME/.config/fish/config.fish' # Open the fish Config in Text editor
|
################ HELPERS ######################################################
|
||||||
|
|
||||||
alias ip 'ip -color'
|
|
||||||
|
|
||||||
alias psmem 'ps auxf | sort -nr -k 4'
|
|
||||||
alias psmem10 'ps auxf | sort -nr -k 4 | head -10'
|
|
||||||
|
|
||||||
alias jctl 'journalctl -p 3 -xb'
|
|
||||||
|
|
||||||
# Common use
|
|
||||||
alias ... 'cd ../..'
|
|
||||||
alias .... 'cd ../../..'
|
|
||||||
alias ..... 'cd ../../../..'
|
|
||||||
alias ...... 'cd ../../../../..'
|
|
||||||
|
|
||||||
alias dir 'dir --color=auto'
|
|
||||||
alias vdir 'vdir --color=auto'
|
|
||||||
|
|
||||||
alias tarnow 'tar -acf '
|
|
||||||
alias untar 'tar -zxvf '
|
|
||||||
|
|
||||||
################# HELPER #####################################################
|
|
||||||
|
|
||||||
function help_pdf
|
function help_pdf
|
||||||
echo "Best Tool to combine pdf: PDF Arranger"
|
echo "Best Tool to combine pdf: PDF Arranger"
|
||||||
echo "Best Tool for OCR: OCRMYPDF but you need to install the teseracts for your languages"
|
echo "Best Tool for OCR: OCRMYPDF but you need to install the tesseracts for your languages"
|
||||||
echo "Best Tool to write in PDFs: XOURNAL++"
|
echo "Best Tool to write in PDFs: XOURNAL++"
|
||||||
end
|
end
|
||||||
|
|
||||||
################# STUFF YOU MAY NOT HAVE #####################################
|
if test -e /usr/bin/rsync
|
||||||
|
function rcp
|
||||||
|
if test (count $argv) -lt 2
|
||||||
|
echo "Usage: rcp SOURCE... DESTINATION"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
rsync -avh --progress $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function rmv
|
||||||
|
if test (count $argv) -lt 2
|
||||||
|
echo "Usage: rmv SOURCE... DESTINATION"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
rsync -avh --progress --remove-source-files $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function rcp
|
||||||
|
echo "'rsync' is not installed. Install it via your package manager."
|
||||||
|
end
|
||||||
|
function rmv
|
||||||
|
echo "'rsync' is not installed. Install it via your package manager."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -e /usr/bin/nano
|
||||||
|
function nanorm
|
||||||
|
if test (count $argv) -lt 1
|
||||||
|
echo "Usage: nanorm {FILE}"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
nano $argv[1]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function nanorm
|
||||||
|
echo "'nano' is not installed. Install it via your package manager."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function source --description "Source files with auto-detection (replaces builtin source)"
|
||||||
|
if test (count $argv) -eq 0
|
||||||
|
builtin source
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
set file $argv[1]
|
||||||
|
set -e argv[1]
|
||||||
|
|
||||||
|
if string match -q -- "--*" $file
|
||||||
|
builtin source $file $argv
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not test -f "$file"
|
||||||
|
echo "source: No such file: '$file'" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if string match -q "*.bash" -- $file
|
||||||
|
if command -q bass
|
||||||
|
bass source $file $argv
|
||||||
|
else
|
||||||
|
echo "source: 'bass' is not installed. Install it to source .bash files." >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
builtin source $file $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
################ TERMINAL-SPECIFIC ############################################
|
||||||
|
|
||||||
if test "$TERM" = "xterm-kitty"
|
if test "$TERM" = "xterm-kitty"
|
||||||
alias icat='kitty +kitten icat'
|
alias icat='kitty +kitten icat'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################ PYTHON #######################################################
|
||||||
|
|
||||||
if test -e /usr/bin/python3
|
if test -e /usr/bin/python3
|
||||||
alias python='python3'
|
alias python='python3'
|
||||||
alias py='python3'
|
alias py='python3'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Easier Ollama Commands
|
if test -e /usr/bin/python3
|
||||||
if test -e /usr/bin/ollama
|
function mkvenv
|
||||||
alias llama_start='ollama serve' # Start the LLama server
|
|
||||||
alias llama3='ollama run llama3' # Start the LLama Chat
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if test -e /usr/bin/btop
|
|
||||||
alias tasks='btop'
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -e /usr/bin/mpv
|
|
||||||
alias uni_play='mpv --vo=tct' # Plays a video in terminal with Unicode
|
|
||||||
alias asci_play='mpv --vo=caca' # Plays a video in terminal with ASCII
|
|
||||||
else
|
|
||||||
for cmd in uni_play asci_play
|
|
||||||
function $cmd
|
|
||||||
echo "You need to install mpv Inorder to use these commands: https://github.com/mpv-player/mpv"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function mkvenv
|
|
||||||
if not type -q python3
|
|
||||||
echo "Python3 is not installed. Please install Python3 to use mkvenv."
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
if not python3 -c "import venv" ^/dev/null
|
if not python3 -c "import venv" ^/dev/null
|
||||||
echo "Python3 'venv' module is not available. Please install it (e.g., 'python3-venv' on Debian/Ubuntu)."
|
echo "Python3 'venv' module is not available. Install python3-venv via your package manager."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
if test (count $argv) -lt 1
|
if test (count $argv) -lt 1
|
||||||
@@ -98,127 +131,130 @@ function mkvenv
|
|||||||
echo "Error: Could not find activate.fish in $argv[1]/bin/"
|
echo "Error: Could not find activate.fish in $argv[1]/bin/"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function mkvenv
|
||||||
|
echo "Python3 is not installed. Please install Python3 to use mkvenv."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function src
|
if test -e /usr/bin/python3
|
||||||
# Check if venv directory exists
|
function src
|
||||||
if not test -d .venv
|
if not test -d .venv
|
||||||
echo "Cannot activate: .venv directory does not exist."
|
echo "Cannot activate: .venv directory does not exist."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if not test -d .venv/bin
|
if not test -d .venv/bin
|
||||||
echo "Cannot activate: .venv/bin directory does not exist."
|
echo "Cannot activate: .venv/bin directory does not exist."
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prefer Fish activation script
|
|
||||||
if test -f .venv/bin/activate.fish
|
if test -f .venv/bin/activate.fish
|
||||||
source .venv/bin/activate.fish
|
source .venv/bin/activate.fish
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fallback to bash activation via bass
|
|
||||||
if test -f .venv/bin/activate.bash
|
if test -f .venv/bin/activate.bash
|
||||||
|
if test -e /usr/bin/bass
|
||||||
bass source .venv/bin/activate.bash
|
bass source .venv/bin/activate.bash
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
echo "'bass' is not installed. Install it via your package manager to source bash scripts."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "No usable activation script found in .venv/bin/"
|
echo "No usable activation script found in .venv/bin/"
|
||||||
return 1
|
return 1
|
||||||
end
|
|
||||||
|
|
||||||
# Check if eza exists in either location
|
|
||||||
if test -x /usr/bin/eza -o -x $HOME/.cargo/bin/eza
|
|
||||||
function ls
|
|
||||||
command eza -a --color=always --group-directories-first --icons $argv # Just more beautiful
|
|
||||||
end
|
|
||||||
function lr
|
|
||||||
command eza -al --color=always --group-directories-first --icons $argv # With rights and Owner
|
|
||||||
end
|
|
||||||
function ll
|
|
||||||
command eza -l --color=always --group-directories-first --icons $argv # Hidden Stuff is hidden
|
|
||||||
end
|
|
||||||
function lt
|
|
||||||
command eza -aT --color=always --group-directories-first --icons $argv # Tree View may take some time
|
|
||||||
end
|
|
||||||
function l.
|
|
||||||
command eza -ald --color=always --group-directories-first --icons .* $argv # Only Hidden Stuff
|
|
||||||
end
|
|
||||||
function lf
|
|
||||||
command eza -aD --color=always --group-directories-first --icons $argv # Only Folder
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Define dummy functions that remind user to install eza
|
function src
|
||||||
|
echo "Python3 is not installed. Please install Python3 to use src."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
################ OLLAMA ######################################################
|
||||||
|
|
||||||
|
if test -e /usr/bin/ollama
|
||||||
|
alias llama_start='ollama serve'
|
||||||
|
alias llama3='ollama run llama3'
|
||||||
|
end
|
||||||
|
|
||||||
|
################ EZA ##########################################################
|
||||||
|
|
||||||
|
if test -x /usr/bin/eza
|
||||||
|
function ls
|
||||||
|
command eza -a --color=always --group-directories-first --icons $argv
|
||||||
|
end
|
||||||
|
function lr
|
||||||
|
command eza -al --color=always --group-directories-first --icons $argv
|
||||||
|
end
|
||||||
|
function ll
|
||||||
|
command eza -l --color=always --group-directories-first --icons $argv
|
||||||
|
end
|
||||||
|
function lt
|
||||||
|
command eza -aT --color=always --group-directories-first --icons $argv
|
||||||
|
end
|
||||||
|
function l.
|
||||||
|
command eza -ald --color=always --group-directories-first --icons .* $argv
|
||||||
|
end
|
||||||
|
function lf
|
||||||
|
command eza -aD --color=always --group-directories-first --icons $argv
|
||||||
|
end
|
||||||
|
else
|
||||||
for cmd in lr ll lt l. lf
|
for cmd in lr ll lt l. lf
|
||||||
function $cmd
|
function $cmd --inherit-variable cmd
|
||||||
echo "The command 'eza' is not installed. Please install 'eza' to use this: https://github.com/eza-community/eza"
|
echo "The command 'eza' is not installed. Please install 'eza' to use this: https://github.com/eza-community/eza"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if test -e /usr/bin/ugrep
|
################ BTOP #########################################################
|
||||||
alias grep 'ugrep --color=auto'
|
|
||||||
alias egrep 'ugrep -E --color=auto'
|
if test -e /usr/bin/btop
|
||||||
alias fgrep 'ugrep -F --color=auto'
|
alias tasks='btop'
|
||||||
|
end
|
||||||
|
|
||||||
|
################ MPV ##########################################################
|
||||||
|
|
||||||
|
if test -e /usr/bin/mpv
|
||||||
|
alias uni_play='mpv --vo=tct'
|
||||||
|
alias asci_play='mpv --vo=caca'
|
||||||
else
|
else
|
||||||
for cmd in egrep fgrep
|
for cmd in uni_play asci_play
|
||||||
function $cmd
|
function $cmd --inherit-variable cmd
|
||||||
echo "The command 'ugrep' is not installed. Please install 'ugrep' to use this: https://github.com/Genivia/ugrep"
|
echo "The command 'mpv' is not installed. Please install mpv to use this: https://github.com/mpv-player/mpv"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################ GREP #########################################################
|
||||||
|
|
||||||
|
if test -e /usr/bin/ugrep
|
||||||
|
alias grep='ugrep --color=auto'
|
||||||
|
alias egrep='ugrep -E --color=auto'
|
||||||
|
alias fgrep='ugrep -F --color=auto'
|
||||||
|
else
|
||||||
|
alias egrep='grep -E'
|
||||||
|
alias fgrep='grep -F'
|
||||||
|
end
|
||||||
|
|
||||||
|
################ WGET #########################################################
|
||||||
|
|
||||||
if test -e /usr/bin/wget
|
if test -e /usr/bin/wget
|
||||||
alias wget 'wget -c '
|
alias wget='wget -c'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################ OCRMYPDF #####################################################
|
||||||
|
|
||||||
if test -e /usr/bin/ocrmypdf
|
if test -e /usr/bin/ocrmypdf
|
||||||
alias ocrmypdf 'ocrmypdf --deskew --clean --rotate-pages'
|
alias ocrmypdf='ocrmypdf --deskew --clean --rotate-pages'
|
||||||
else
|
else
|
||||||
alias ocrmypdf 'echo "The command 'ocrmypdf' is not installed. Please install 'ocrmypdf' to use this: https://github.com/ocrmypdf/OCRmyPDF"'
|
function ocrmypdf
|
||||||
end
|
echo "The command 'ocrmypdf' is not installed. Install it via your package manager: https://github.com/ocrmypdf/OCRmyPDF"
|
||||||
|
|
||||||
function rcp
|
|
||||||
if test (count $argv) -lt 2
|
|
||||||
echo "Usage: rcp SOURCE... DESTINATION"
|
|
||||||
return 1
|
|
||||||
end
|
end
|
||||||
rsync -avh --progress $argv
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function rmv
|
################ YAZI #########################################################
|
||||||
if test (count $argv) -lt 2
|
|
||||||
echo "Usage: rmv SOURCE... DESTINATION"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
rsync -avh --progress --remove-source-files $arg
|
|
||||||
end
|
|
||||||
|
|
||||||
function nanorm
|
if test -e /usr/bin/yazi
|
||||||
if test (count $argv) -lt 1
|
|
||||||
echo "Usage: nanorm {FILE}"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
set arg $argv[1]
|
|
||||||
if test -f $arg
|
|
||||||
rm $arg
|
|
||||||
end
|
|
||||||
nano $arg
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -e /usr/bin/reflector
|
|
||||||
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'
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -e $HOME/.config/sway/config
|
|
||||||
alias sway_config='nano $HOME/.config/sway/config' # Open the fish Config in Text editor
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -e /usr/bin/yazi -o -e /usr/local/bin/yazi
|
|
||||||
function y
|
function y
|
||||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
||||||
yazi $argv --cwd-file="$tmp"
|
yazi $argv --cwd-file="$tmp"
|
||||||
@@ -228,15 +264,21 @@ if test -e /usr/bin/yazi -o -e /usr/local/bin/yazi
|
|||||||
rm -f -- "$tmp"
|
rm -f -- "$tmp"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
function yazi
|
for cmd in yazi y
|
||||||
|
function $cmd --inherit-variable cmd
|
||||||
echo "The command 'yazi' is not installed. Please install 'yazi' to use this: https://github.com/sxyazi/yazi"
|
echo "The command 'yazi' is not installed. Please install 'yazi' to use this: https://github.com/sxyazi/yazi"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################ SUDO #########################################################
|
||||||
|
|
||||||
if test -e /usr/bin/sudo-rs
|
if test -e /usr/bin/sudo-rs
|
||||||
alias sudo=sudo-rs
|
alias sudo=sudo-rs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################ FLASH ISO ####################################################
|
||||||
|
|
||||||
if test -e /usr/bin/dd
|
if test -e /usr/bin/dd
|
||||||
function flashiso --description "Flash an ISO to a target drive with dd"
|
function flashiso --description "Flash an ISO to a target drive with dd"
|
||||||
if test (count $argv) -ne 2
|
if test (count $argv) -ne 2
|
||||||
@@ -244,25 +286,6 @@ if test -e /usr/bin/dd
|
|||||||
echo "Example: flashiso ubuntu-25.10-desktop-amd64.iso /dev/sdb"
|
echo "Example: flashiso ubuntu-25.10-desktop-amd64.iso /dev/sdb"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
sudo dd if=$argv[1] of=$argv[2] bs=4M status=progress oflag=sync
|
||||||
set iso $argv[1]
|
|
||||||
set drive $argv[2]
|
|
||||||
|
|
||||||
sudo dd if=$iso of=$drive bs=4M status=progress oflag=sync
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#### SOURCE of bash
|
|
||||||
|
|
||||||
function smart_source
|
|
||||||
set file $argv[1]
|
|
||||||
|
|
||||||
if string match -q "*.bash" -- $file
|
|
||||||
bass source $file
|
|
||||||
else if string match -q "*.fish" -- $file
|
|
||||||
builtin source $file
|
|
||||||
else
|
|
||||||
# fallback: try fish source by default
|
|
||||||
builtin source $file
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+40
-24
@@ -4,13 +4,6 @@
|
|||||||
|
|
||||||
source $HOME/.config/fish/configs/uni.fish
|
source $HOME/.config/fish/configs/uni.fish
|
||||||
|
|
||||||
alias git_update='$HOME/.config/fish/scripts/git-update.sh'
|
|
||||||
|
|
||||||
alias mount_all='$HOME/.config/fish/scripts/mount.sh'
|
|
||||||
alias umount_all='$HOME/.config/fish/scripts/umount.sh'
|
|
||||||
|
|
||||||
alias print_cam='ssh honney@192.168.1.184'
|
|
||||||
|
|
||||||
function updateall
|
function updateall
|
||||||
# Get current Discord version (if installed)
|
# Get current Discord version (if installed)
|
||||||
if pacman -Q discord >/dev/null 2>&1
|
if pacman -Q discord >/dev/null 2>&1
|
||||||
@@ -35,11 +28,15 @@ function updateall
|
|||||||
set discord_version_after ""
|
set discord_version_after ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# Compare versions
|
# Compare discord versions
|
||||||
if test "$discord_version_before" != "$discord_version_after"
|
if test "$discord_version_before" != "$discord_version_after"
|
||||||
echo "Discord version changed: $discord_version_before -> $discord_version_after"
|
echo "Discord version changed: $discord_version_before -> $discord_version_after"
|
||||||
echo "Running extra command..."
|
if test -e /usr/bin/curl
|
||||||
|
echo "Running Vencord installer..."
|
||||||
sh -c "$(curl -sS https://raw.githubusercontent.com/Vendicated/VencordInstaller/main/install.sh)"
|
sh -c "$(curl -sS https://raw.githubusercontent.com/Vendicated/VencordInstaller/main/install.sh)"
|
||||||
|
else
|
||||||
|
echo "'curl' is not installed. Install it to update Discord plugins."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if test -e /usr/bin/flatpak
|
if test -e /usr/bin/flatpak
|
||||||
@@ -57,7 +54,7 @@ function updateall
|
|||||||
set kernel_version_after ""
|
set kernel_version_after ""
|
||||||
end
|
end
|
||||||
if test "$kernel_version_before" != "$kernel_version_after"
|
if test "$kernel_version_before" != "$kernel_version_after"
|
||||||
echo "Discord version changed: $kernel_version_before -> $kernel_version_after"
|
echo "Kernel changed: $kernel_version_before -> $kernel_version_after"
|
||||||
echo -n "Reboot now? [y/N]: "
|
echo -n "Reboot now? [y/N]: "
|
||||||
|
|
||||||
read answer
|
read answer
|
||||||
@@ -70,30 +67,49 @@ function updateall
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alias fixpacman='sudo rm /var/lib/pacman/db.lck'
|
alias fixpacman='sudo rm -f /var/lib/pacman/db.lck'
|
||||||
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
|
|
||||||
|
|
||||||
|
|
||||||
if test -e /usr/bin/expac
|
if test -e /usr/bin/expac
|
||||||
alias rip 'expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl'
|
alias rip='expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl'
|
||||||
alias big='expac -H M "%m\t%n" | sort -h | nl' # Sort installed packages according to size in MB (expac must be installed)
|
alias big='expac -H M "%m\t%n" | sort -h | nl'
|
||||||
|
else
|
||||||
|
alias rip="echo 'expac is not installed. Install it to list last deinstalled packages.'"
|
||||||
|
alias big="echo 'expac is not installed. Install it to list biggest packages.'"
|
||||||
end
|
end
|
||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
while pacman -Qdtq
|
while pacman -Qdtq >/dev/null 2>&1
|
||||||
sudo pacman -R (pacman -Qdtq)
|
set orphans (pacman -Qdtq 2>/dev/null)
|
||||||
|
if test -z "$orphans"
|
||||||
|
break
|
||||||
end
|
end
|
||||||
|
sudo pacman -R $orphans
|
||||||
|
end
|
||||||
|
echo "No more orphaned packages."
|
||||||
end
|
end
|
||||||
|
|
||||||
set -x XCURSOR_THEME "DJ-FOX-C"
|
if test -x $HOME/.local/python-3.11.9/bin/python3.11
|
||||||
set -x XCURSOR_SIZE 24
|
alias py311="$HOME/.local/python-3.11.9/bin/python3.11"
|
||||||
|
end
|
||||||
|
|
||||||
alias py311="$HOME/.local/python-3.11.9/bin/python3.11"
|
if test -e /usr/bin/tmux
|
||||||
|
function quickshell-reload
|
||||||
function quickshell-reload
|
|
||||||
if test -e /usr/bin/quickshell
|
if test -e /usr/bin/quickshell
|
||||||
tmux kill-session -t qs
|
tmux kill-session -t qs 2>/dev/null
|
||||||
tmux new-session -d -s qs 'quickshell'
|
tmux new-session -d -s qs 'quickshell'
|
||||||
else
|
else
|
||||||
echo "quickshell not installed"
|
echo "'quickshell' is not installed. Install it via your package manager."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function quickshell-reload
|
||||||
|
echo "'tmux' is not installed. Install it via your package manager."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if test -e /usr/bin/reflector
|
||||||
|
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'
|
||||||
|
end
|
||||||
+1
-1
@@ -3,5 +3,5 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if test -d $HOME/.bin
|
if test -d $HOME/.bin
|
||||||
set -U fish_user_paths $HOME/.bin $fish_user_paths
|
fish_add_path $HOME/.bin
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
alias updateall='sudo dnf upgrade --refresh && flatpak update'
|
alias updateall='sudo dnf upgrade --refresh && flatpak update'
|
||||||
|
|
||||||
if test -e $HOME/.cargo/bin/eza
|
if test -x $HOME/.cargo/bin/eza
|
||||||
set -gx PATH $HOME/.cargo/bin $PATH $PATH
|
fish_add_path $HOME/.cargo/bin
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -f $HOME/.config/fish/configs/uni.fish
|
||||||
|
source $HOME/.config/fish/configs/uni.fish
|
||||||
end
|
end
|
||||||
|
|||||||
+4
-41
@@ -1,46 +1,9 @@
|
|||||||
# Load pywal colors (extract from ~/.cache/wal/colors.json)
|
# load matugen-generated colors
|
||||||
if test -e $HOME/.cache/wal/colors.json1
|
if test -f $HOME/.config/fish/configs/colors.fish
|
||||||
set -g theme_0 (jq -r '.colors.color0' ~/.cache/wal/colors.json) # Primary color
|
source $HOME/.config/fish/configs/colors.fish
|
||||||
set -g theme_1 (jq -r '.colors.color1' ~/.cache/wal/colors.json) # Secondary color (e.g., for git, @)
|
|
||||||
set -g theme_2 (jq -r '.colors.color2' ~/.cache/wal/colors.json) # Third color (e.g., for hostname)
|
|
||||||
set -g background_color (jq -r '.special.background' ~/.cache/wal/colors.json) # Background color
|
|
||||||
set -g foreground_color (jq -r '.special.foreground' ~/.cache/wal/colors.json) # Foreground color
|
|
||||||
else
|
|
||||||
set -g background_color "#1e1e2e" # Dark slate
|
|
||||||
set -g foreground_color "#cdd6f4" # Soft white/light gray
|
|
||||||
|
|
||||||
# Primary and accent colors
|
|
||||||
set -g theme_0 "#a6e3a1" # Green - success, directories
|
|
||||||
set -g theme_1 "#f38ba8" # Red - errors, git changes
|
|
||||||
set -g theme_2 "#89b4fa" # Blue - hostnames, info
|
|
||||||
|
|
||||||
# Extra accent colors
|
|
||||||
set -g theme_3 "#f9e2af" # Yellow - warnings
|
|
||||||
set -g theme_4 "#cba6f7" # Magenta - user prompts
|
|
||||||
set -g theme_5 "#94e2d5" # Cyan - secondary info
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# BOBTHEFISH COLORING: Apply pywal colors to the bobthefish theme
|
# Bobthefish display settings
|
||||||
|
|
||||||
# Username Color
|
|
||||||
set -g theme_username_color $theme_0
|
|
||||||
|
|
||||||
# Hostname Color
|
|
||||||
set -g theme_hostname_color $theme_2
|
|
||||||
|
|
||||||
# Git prompt color
|
|
||||||
set -g theme_git_branch_color $theme_1
|
|
||||||
set -g theme_git_dirty_color $theme_1
|
|
||||||
set -g theme_git_staged_color $theme_2
|
|
||||||
|
|
||||||
# Current directory color
|
|
||||||
set -g theme_pwd_color $theme_0
|
|
||||||
|
|
||||||
# Set background and foreground based on pywal theme
|
|
||||||
set -g theme_background_color $background_color
|
|
||||||
set -g theme_foreground_color $foreground_color
|
|
||||||
|
|
||||||
# Retain all existing theme settings (don't overwrite the options you have)
|
|
||||||
set -g theme_display_git yes
|
set -g theme_display_git yes
|
||||||
set -g theme_display_git_dirty no
|
set -g theme_display_git_dirty no
|
||||||
set -g theme_display_git_untracked no
|
set -g theme_display_git_untracked no
|
||||||
|
|||||||
@@ -5,4 +5,6 @@
|
|||||||
alias updateall='sudo apt upgrade -y && sudo apt update -y'
|
alias updateall='sudo apt upgrade -y && sudo apt update -y'
|
||||||
alias uninstall='sudo apt purge -y'
|
alias uninstall='sudo apt purge -y'
|
||||||
|
|
||||||
source $HOME/.config/fish/configs/uni.fish
|
if test -f $HOME/.config/fish/configs/uni.fish
|
||||||
|
source $HOME/.config/fish/configs/uni.fish
|
||||||
|
end
|
||||||
|
|||||||
+6
-8
@@ -1,19 +1,17 @@
|
|||||||
if test -x /usr/bin/pacman
|
if command -q pacman
|
||||||
if test -d ~/Nextcloud/UNI/26_TI/RISC-V
|
if test -d ~/Nextcloud/UNI/26_TI/RISC-V
|
||||||
set -U fish_user_paths ~/Nextcloud/UNI/26_TI/RISC-V/xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64/xpack-riscv-none-elf-gcc-15.2.0-1/bin $fish_user_paths
|
fish_add_path ~/Nextcloud/UNI/26_TI/RISC-V/xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64/xpack-riscv-none-elf-gcc-15.2.0-1/bin
|
||||||
set -U fish_user_paths ~/Nextcloud/UNI/26_TI/RISC-V/verible-v0.0-4053-g89d4d98a-linux-static-x86_64/verible-v0.0-4053-g89d4d98a/bin $fish_user_paths
|
fish_add_path ~/Nextcloud/UNI/26_TI/RISC-V/verible-v0.0-4053-g89d4d98a-linux-static-x86_64/verible-v0.0-4053-g89d4d98a/bin
|
||||||
end
|
end
|
||||||
if test -d ~/Projects/RISC-V
|
if test -d ~/Projects/RISC-V
|
||||||
set -gx XILINX_VIVADO ~/Projects/RISC-V/vivado/Vivado/2022.2
|
set -gx XILINX_VIVADO ~/Projects/RISC-V/vivado/Vivado/2022.2
|
||||||
set -U fish_user_paths ~/Projects/RISC-V/vivado/Vivado/2022.2/bin $fish_user_paths
|
fish_add_path ~/Projects/RISC-V/vivado/Vivado/2022.2/bin
|
||||||
set -gx LM_LICENSE_FILE ~/Projects/RISC-V/intel/LR-160568_License.dat
|
set -gx LM_LICENSE_FILE ~/Projects/RISC-V/intel/LR-160568_License.dat
|
||||||
set -gx SALT_LICENSE_SERVER $LM_LICENSE_FILE
|
set -gx SALT_LICENSE_SERVER $LM_LICENSE_FILE
|
||||||
set -U fish_user_paths ~/Projects/RISC-V/intel/questa_fse/bin $fish_user_paths
|
fish_add_path ~/Projects/RISC-V/intel/questa_fse/bin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set in_container (test -f /.dockerenv; or test -f /run/.containerenv; and echo yes; or echo no)
|
if test -f /.dockerenv; or test -f /run/.containerenv
|
||||||
|
|
||||||
if test "in_container" = yes
|
|
||||||
echo "In Container"
|
echo "In Container"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# This file contains fish universal variable definitions.
|
|
||||||
# VERSION: 3.0
|
|
||||||
SETUVAR __done_min_cmd_duration:5000
|
|
||||||
SETUVAR __done_notify_sound:1
|
|
||||||
SETUVAR __done_sway_ignore_visible:0
|
|
||||||
SETUVAR __fish_initialized:4300
|
|
||||||
SETUVAR fish_user_paths:/home/honney/Projects/RISC\x2dV/intel/questa_fse/bin\x1e/home/honney/Projects/RISC\x2dV/vivado/Vivado/2022\x2e2/bin\x1e/home/honney/Nextcloud/UNI/26_TI/RISC\x2dV/verible\x2dv0\x2e0\x2d4053\x2dg89d4d98a\x2dlinux\x2dstatic\x2dx86_64/verible\x2dv0\x2e0\x2d4053\x2dg89d4d98a/bin\x1e/home/honney/Nextcloud/UNI/26_TI/RISC\x2dV/xpack\x2driscv\x2dnone\x2delf\x2dgcc\x2d15\x2e2\x2e0\x2d1\x2dlinux\x2dx64/xpack\x2driscv\x2dnone\x2delf\x2dgcc\x2d15\x2e2\x2e0\x2d1/bin\x1e/home/honney/\x2ebin\x1e/opt/rocm/bin
|
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
function addpaths
|
function addpaths
|
||||||
contains -- $argv $fish_user_paths
|
if test (count $argv) -lt 1
|
||||||
or set -U fish_user_paths $fish_user_paths $argv
|
echo "Usage: addpaths <path> [more paths...]"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
for p in $argv
|
||||||
|
if not contains -- $p $fish_user_paths
|
||||||
|
fish_add_path -U $p
|
||||||
|
end
|
||||||
|
end
|
||||||
echo "Updated PATH: $PATH"
|
echo "Updated PATH: $PATH"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
function compare_sha256
|
|
||||||
if test (count $argv) -ne 2
|
|
||||||
echo "Usage: compare_sha256 <file1> <file2>"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
set hash1 (sha256sum $argv[1] | awk '{print $1}')
|
|
||||||
set hash2 (sha256sum $argv[2] | awk '{print $1}')
|
|
||||||
|
|
||||||
if test "$hash1" = "$hash2"
|
|
||||||
echo "Match"
|
|
||||||
else
|
|
||||||
echo "Different"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
+117
-12
@@ -1,14 +1,18 @@
|
|||||||
function extract
|
function extract --description "Extract various archive formats"
|
||||||
if test (count $argv) -lt 1
|
if test (count $argv) -lt 1
|
||||||
echo "Usage: extract <archive(s)> [output_directory]"
|
echo "Usage: extract <archive(s)> [output_directory]"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not command -q file
|
||||||
|
echo "extract: 'file' command is required. Install it via your package manager."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set archives $argv
|
set archives $argv
|
||||||
set output_dir "."
|
set output_dir "."
|
||||||
set use_custom_dir 0
|
set use_custom_dir 0
|
||||||
|
|
||||||
# If exactly 2 args and second is a directory (or doesn't exist yet), treat it as output dir
|
|
||||||
if test (count $argv) -eq 2
|
if test (count $argv) -eq 2
|
||||||
set maybe_dir $argv[2]
|
set maybe_dir $argv[2]
|
||||||
if test -d "$maybe_dir"; or not test -e "$maybe_dir"
|
if test -d "$maybe_dir"; or not test -e "$maybe_dir"
|
||||||
@@ -19,7 +23,6 @@ function extract
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Detect multiple archives
|
|
||||||
set multi 0
|
set multi 0
|
||||||
if test (count $archives) -gt 1
|
if test (count $archives) -gt 1
|
||||||
set multi 1
|
set multi 1
|
||||||
@@ -31,10 +34,8 @@ function extract
|
|||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine base name (strip extensions)
|
set base (string replace -r '\.(tar\.(gz|bz2|xz|zst)|tar|tgz|tbz2|txz|tzst|gz|bz2|xz|zst|zip|7z|rar)$' '' (basename "$archive"))
|
||||||
set base (string replace -r '\.(tar\.gz|tgz|tar\.bz2|tbz2|tar\.xz|txz|gz|bz2|xz|zst|zip|7z|rar)$' '' (basename "$archive"))
|
|
||||||
|
|
||||||
# Decide target directory
|
|
||||||
if test $multi -eq 1
|
if test $multi -eq 1
|
||||||
set target_dir "$base"
|
set target_dir "$base"
|
||||||
else if test $use_custom_dir -eq 1
|
else if test $use_custom_dir -eq 1
|
||||||
@@ -43,27 +44,131 @@ function extract
|
|||||||
set target_dir "$base"
|
set target_dir "$base"
|
||||||
end
|
end
|
||||||
|
|
||||||
mkdir -p "$target_dir"
|
|
||||||
|
|
||||||
set mime (file --mime-type -b "$archive")
|
set mime (file --mime-type -b "$archive")
|
||||||
|
|
||||||
switch $mime
|
switch $mime
|
||||||
case 'application/x-tar'
|
case 'application/x-tar'
|
||||||
|
if not command -q tar
|
||||||
|
echo "extract: 'tar' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
tar -xvf "$archive" -C "$target_dir"
|
tar -xvf "$archive" -C "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
|
||||||
case 'application/gzip'
|
case 'application/gzip'
|
||||||
tar xvzf "$archive" -C "$target_dir"
|
if string match -q '*.tar.gz' -- "$archive"; or string match -q '*.tgz' -- "$archive"
|
||||||
|
if not command -q tar
|
||||||
|
echo "extract: 'tar' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
tar -xzf "$archive" -C "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
if not command -q gzip
|
||||||
|
echo "extract: 'gzip' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
set outname (string replace -r '\.gz$' '' (basename "$archive"))
|
||||||
|
gzip -dkc "$archive" > "$output_dir/$outname"
|
||||||
|
echo "extract: decompressed '$archive' to '$output_dir/$outname'"
|
||||||
|
end
|
||||||
|
|
||||||
case 'application/x-bzip2'
|
case 'application/x-bzip2'
|
||||||
tar xvjf "$archive" -C "$target_dir"
|
if string match -q '*.tar.bz2' -- "$archive"; or string match -q '*.tbz2' -- "$archive"
|
||||||
|
if not command -q tar
|
||||||
|
echo "extract: 'tar' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
tar -xjf "$archive" -C "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
if not command -q bzip2
|
||||||
|
echo "extract: 'bzip2' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
set outname (string replace -r '\.bz2$' '' (basename "$archive"))
|
||||||
|
bzip2 -dkc "$archive" > "$output_dir/$outname"
|
||||||
|
echo "extract: decompressed '$archive' to '$output_dir/$outname'"
|
||||||
|
end
|
||||||
|
|
||||||
case 'application/x-xz'
|
case 'application/x-xz'
|
||||||
tar xvJf "$archive" -C "$target_dir"
|
if string match -q '*.tar.xz' -- "$archive"; or string match -q '*.txz' -- "$archive"
|
||||||
|
if not command -q tar
|
||||||
|
echo "extract: 'tar' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
tar -xJf "$archive" -C "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
if not command -q xz
|
||||||
|
echo "extract: 'xz' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
set outname (string replace -r '\.xz$' '' (basename "$archive"))
|
||||||
|
xz -dkc "$archive" > "$output_dir/$outname"
|
||||||
|
echo "extract: decompressed '$archive' to '$output_dir/$outname'"
|
||||||
|
end
|
||||||
|
|
||||||
case 'application/zstd'
|
case 'application/zstd'
|
||||||
|
if string match -q '*.tar.zst' -- "$archive"; or string match -q '*.tzst' -- "$archive"
|
||||||
|
if not command -q tar
|
||||||
|
echo "extract: 'tar' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
tar --zstd -xvf "$archive" -C "$target_dir"
|
tar --zstd -xvf "$archive" -C "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
if not command -q zstd
|
||||||
|
echo "extract: 'zstd' is not installed. Install it via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
set outname (string replace -r '\.zst$' '' (basename "$archive"))
|
||||||
|
zstd -dkc "$archive" > "$output_dir/$outname"
|
||||||
|
echo "extract: decompressed '$archive' to '$output_dir/$outname'"
|
||||||
|
end
|
||||||
|
|
||||||
case 'application/zip'
|
case 'application/zip'
|
||||||
|
if not command -q unzip
|
||||||
|
echo "extract: 'unzip' is not installed. Install it via your package manager (e.g., 'unzip' on most distros)."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
mkdir -p "$target_dir"
|
||||||
unzip "$archive" -d "$target_dir"
|
unzip "$archive" -d "$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
|
||||||
case 'application/x-7z-compressed'
|
case 'application/x-7z-compressed'
|
||||||
|
if command -q 7z
|
||||||
|
mkdir -p "$target_dir"
|
||||||
7z x "$archive" -o"$target_dir"
|
7z x "$archive" -o"$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else if command -q 7zz
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
7zz x "$archive" -o"$target_dir"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
echo "extract: '7z' or '7zz' is not installed. Install p7zip via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
case 'application/x-rar' 'application/vnd.rar'
|
case 'application/x-rar' 'application/vnd.rar'
|
||||||
unrar x -o+ "$archive" "$target_dir"
|
if command -q unrar
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
unrar x -o+ "$archive" "$target_dir/"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else if command -q rar
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
rar x -o+ "$archive" "$target_dir/"
|
||||||
|
echo "extract: extracted '$archive' to '$target_dir'"
|
||||||
|
else
|
||||||
|
echo "extract: 'unrar' or 'rar' is not installed. Install unrar via your package manager."
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
case '*'
|
case '*'
|
||||||
echo "extract: unknown file type for '$archive' ($mime)"
|
echo "extract: unknown file type for '$archive' ($mime)"
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ function findstr
|
|||||||
echo "Usage: findstr <search-string>"
|
echo "Usage: findstr <search-string>"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
if not command -q find
|
||||||
|
echo "findstr: 'find' is not installed."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if not command -q grep
|
||||||
|
echo "findstr: 'grep' is not installed."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set query $argv[1]
|
find . -type f -exec grep -Hn "$argv[1]" {} \;
|
||||||
|
|
||||||
find . -type f -exec grep -Hn "$query" {} \;
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
# Load pywal colors
|
|
||||||
set -g theme_0 (jq -r '.colors.color0' ~/.cache/wal/colors.json) # Color0 for general text
|
|
||||||
set -g theme_1 (jq -r '.colors.color1' ~/.cache/wal/colors.json) # Color1 for highlights (e.g., @ symbol)
|
|
||||||
set -g theme_2 (jq -r '.colors.color2' ~/.cache/wal/colors.json) # Color2 for hostname
|
|
||||||
set -g background_color (jq -r '.special.background' ~/.cache/wal/colors.json) # Background color
|
|
||||||
set -g foreground_color (jq -r '.special.foreground' ~/.cache/wal/colors.json) # Foreground color
|
|
||||||
|
|
||||||
# Customize your prompt
|
|
||||||
function fish_prompt
|
|
||||||
# Set background and foreground colors
|
|
||||||
echo -n (set_color $background_color) # Set background color
|
|
||||||
echo -n (set_color $foreground_color) # Set foreground color for text
|
|
||||||
echo -n (set_color $theme_0) 'user' (set_color $theme_1) '@' (set_color $theme_2) 'host' (set_color normal) '> '
|
|
||||||
end
|
|
||||||
|
|
||||||
+5
-2
@@ -3,12 +3,15 @@ function pack
|
|||||||
echo "Usage: pack <archive-name> <file-or-dir> [more files...]"
|
echo "Usage: pack <archive-name> <file-or-dir> [more files...]"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
if not command -q tar
|
||||||
|
echo "pack: 'tar' is not installed. Install it via your package manager."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set archive $argv[1]
|
set archive $argv[1]
|
||||||
set targets $argv[2..-1]
|
set targets $argv[2..-1]
|
||||||
|
|
||||||
# Ensure .tar.xz extension
|
if not string match -q '*.tar.xz' -- $archive
|
||||||
if not string match -r '\.tar\.xz$' -- $archive
|
|
||||||
set archive "$archive.tar.xz"
|
set archive "$archive.tar.xz"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
function removepath
|
function removepath
|
||||||
|
if test (count $argv) -lt 1
|
||||||
|
echo "Usage: removepath <path>"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
if set -l index (contains -i $argv[1] $PATH)
|
if set -l index (contains -i $argv[1] $PATH)
|
||||||
set --erase --universal fish_user_paths[$index]
|
set --erase --universal fish_user_paths[$index]
|
||||||
echo "Updated PATH: $PATH"
|
echo "Removed '$argv[1]' from PATH."
|
||||||
else
|
else
|
||||||
echo "$argv[1] not found in PATH: $PATH"
|
echo "'$argv[1]' not found in PATH."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ function search
|
|||||||
echo "Usage: search <string> [directory]"
|
echo "Usage: search <string> [directory]"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
if not command -q rg
|
||||||
|
echo "search: 'rg' (ripgrep) is not installed. Install it via your package manager."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set query $argv[1]
|
set query $argv[1]
|
||||||
set dir "."
|
set dir "."
|
||||||
|
|
||||||
if test (count $argv) -ge 2
|
if test (count $argv) -ge 2
|
||||||
set dir $argv[2]
|
set dir $argv[2]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
function verify_file
|
||||||
|
if test (count $argv) -ne 2
|
||||||
|
echo "Usage: verify_file <file> <expected_hash>"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set file $argv[1]
|
||||||
|
if not test -f "$file"
|
||||||
|
echo "verify_file: '$file' is not a valid file"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set expected $argv[2]
|
||||||
|
set len (string length "$expected")
|
||||||
|
|
||||||
|
switch $len
|
||||||
|
case 32
|
||||||
|
set cmd md5sum
|
||||||
|
case 40
|
||||||
|
set cmd sha1sum
|
||||||
|
case 56
|
||||||
|
set cmd sha224sum
|
||||||
|
case 64
|
||||||
|
set cmd sha256sum
|
||||||
|
case 96
|
||||||
|
set cmd sha384sum
|
||||||
|
case 128
|
||||||
|
if command -q sha512sum
|
||||||
|
set cmd sha512sum
|
||||||
|
else if command -q b2sum
|
||||||
|
set cmd b2sum
|
||||||
|
else
|
||||||
|
echo "verify_file: no tool available for 128-char hash (sha512sum or b2sum required)"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
case '*'
|
||||||
|
echo "verify_file: unknown hash length ($len chars). Supported: md5(32), sha1(40), sha224(56), sha256(64), sha384(96), sha512/b2(128)"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if not command -q $cmd
|
||||||
|
echo "verify_file: '$cmd' is not installed."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set actual ($cmd "$file" | string split -f1 " ")
|
||||||
|
|
||||||
|
if test "$actual" = "$expected"
|
||||||
|
echo "Match"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "Mismatch"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
Executable
+84
@@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
detect_pkg_manager() {
|
||||||
|
if command -v apt &>/dev/null; then
|
||||||
|
echo "apt"
|
||||||
|
elif command -v dnf &>/dev/null; then
|
||||||
|
echo "dnf"
|
||||||
|
elif command -v pacman &>/dev/null; then
|
||||||
|
echo "pacman"
|
||||||
|
elif command -v zypper &>/dev/null; then
|
||||||
|
echo "zypper"
|
||||||
|
else
|
||||||
|
echo "unknown"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_fish() {
|
||||||
|
local pm
|
||||||
|
pm=$(detect_pkg_manager)
|
||||||
|
case "$pm" in
|
||||||
|
apt)
|
||||||
|
sudo apt update && sudo apt install -y fish
|
||||||
|
;;
|
||||||
|
dnf)
|
||||||
|
sudo dnf install -y fish
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -S --noconfirm fish
|
||||||
|
;;
|
||||||
|
zypper)
|
||||||
|
sudo zypper install -y fish
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "No supported package manager found. Please install fish manually: https://fishshell.com"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
install_omf() {
|
||||||
|
if [ ! -d "$HOME/.local/share/omf" ]; then
|
||||||
|
echo "Installing Oh My Fish..."
|
||||||
|
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
|
||||||
|
fish install --path=~/.local/share/omf --config=~/.config/omf
|
||||||
|
else
|
||||||
|
echo "Oh My Fish already installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_bobthefish() {
|
||||||
|
if command -v fish &>/dev/null && [ -f "$HOME/.local/share/omf/init.fish" ]; then
|
||||||
|
echo "Installing bobthefish theme..."
|
||||||
|
fish -c 'omf install bobthefish'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_default_shell() {
|
||||||
|
local fish_path
|
||||||
|
fish_path=$(command -v fish)
|
||||||
|
if [ "$SHELL" != "$fish_path" ]; then
|
||||||
|
echo "Setting default shell to fish..."
|
||||||
|
if grep -q "^$USER:" /etc/passwd 2>/dev/null; then
|
||||||
|
chsh -s "$fish_path"
|
||||||
|
else
|
||||||
|
echo "Run this manually: chsh -s $fish_path"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Fish is already your default shell."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
install_fish
|
||||||
|
install_omf
|
||||||
|
install_bobthefish
|
||||||
|
set_default_shell
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Installation complete ==="
|
||||||
|
echo "Log out and back in, or run: exec fish"
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
Reference in New Issue
Block a user