updated antidote in prep for usage on laptop

This commit is contained in:
eeleater 2024-08-15 23:25:11 +02:00
parent 4dce77ed89
commit ef46d0e0a0
11 changed files with 29 additions and 281 deletions

View file

@ -7,7 +7,7 @@ enable_audio_bell no
shell_integration disabled shell_integration disabled
# Fonts # Fonts
font_family FiraCode Nerd Font font_family CommitMono Nerd Font
# BEGIN_KITTY_THEME # BEGIN_KITTY_THEME
# Dracula # Dracula

View file

@ -21,11 +21,11 @@ skip_notify = true
#run_in_tmux = true #run_in_tmux = true
# List of remote machines with Topgrade installed on them # List of remote machines with Topgrade installed on them
{{ if eq .chezmoi.hostname "pxm" }} {{- if eq .chezmoi.hostname "pxm" }}
remote_topgrades = ["docker", "kali", "mail"] remote_topgrades = ["docker", "kali", "mail"]
{{ else }} {{- else }}
remote_topgrades = ["pxm", "web", "infra"] remote_topgrades = ["pxm", "web", "infra"]
{{ end }} {{- end }}
# Arguments to pass SSH when upgrading remote systems # Arguments to pass SSH when upgrading remote systems
#ssh_arguments = "-o ConnectTimeout=2" #ssh_arguments = "-o ConnectTimeout=2"

View file

@ -1 +0,0 @@
# create the file

View file

@ -1,32 +1,33 @@
# completions
zsh-users/zsh-completions
# lscolors # lscolors
trapd00r/LS_COLORS trapd00r/LS_COLORS
# ohmyzsh # ohmyzsh
ohmyzsh/ohmyzsh path:lib/completion.zsh getantidote/use-omz
ohmyzsh/ohmyzsh path:lib/key-bindings.zsh ohmyzsh/ohmyzsh path:lib
ohmyzsh/ohmyzsh path:lib/history.zsh
ohmyzsh/ohmyzsh path:lib/directories.zsh # omz plugins
ohmyzsh/ohmyzsh path:plugins/systemd ohmyzsh/ohmyzsh path:plugins/systemd
ohmyzsh/ohmyzsh path:plugins/command-not-found ohmyzsh/ohmyzsh path:plugins/command-not-found
ohmyzsh/ohmyzsh path:plugins/fzf
ohmyzsh/ohmyzsh path:plugins/ssh-agent ohmyzsh/ohmyzsh path:plugins/ssh-agent
# other plugins # utility plugins
Aloxaf/fzf-tab 3v1n0/zsh-bash-completions-fallback
urbainvaes/fzf-marks
mroth/evalcache mroth/evalcache
zpm-zsh/colorize zpm-zsh/colorize
sobolevn/wakatime-zsh-plugin
amyreese/zsh-titles
laggardkernel/zsh-thefuck
twopizza9621536/zsh-eza twopizza9621536/zsh-eza
fdellwing/zsh-bat fdellwing/zsh-bat
amyreese/zsh-titles
Aloxaf/fzf-tab
# other plugins
urbainvaes/fzf-marks
sobolevn/wakatime-zsh-plugin
laggardkernel/zsh-thefuck
MichaelAquilina/zsh-you-should-use MichaelAquilina/zsh-you-should-use
asdf-vm/asdf asdf-vm/asdf
olets/zsh-abbr
# fish like # fish like (load last)
zsh-users/zsh-completions path:src kind:fpath
zsh-users/zsh-autosuggestions zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting zdharma-continuum/fast-syntax-highlighting

View file

@ -1,6 +1,10 @@
test -v DISTROBOX_HOST_HOME && { unset ZDOTDIR; exec zsh } # fix distrobox test -v DISTROBOX_HOST_HOME && { unset ZDOTDIR; exec zsh } # fix distrobox
test "x$TERMINALNAME" = "xalacritty" && eval "$(zellij setup --generate-auto-start zsh)" # autostart zellij only in alacritty test "x$TERMINALNAME" = "xalacritty" && eval "$(zellij setup --generate-auto-start zsh)" # autostart zellij only in alacritty
# options
setopt NO_CLOBBER INTERACTIVE_COMMENTS HASH_EXECUTABLES_ONLY NUMERIC_GLOB_SORT
unsetopt FLOW_CONTROL
# deduplicate path # deduplicate path
typeset -U path PATH typeset -U path PATH
path+=("$XDG_DATA_HOME"/JetBrains/Toolbox/scripts) # jetbrains toolbox path+=("$XDG_DATA_HOME"/JetBrains/Toolbox/scripts) # jetbrains toolbox
@ -10,28 +14,23 @@ path+=("$HOME"/.local/bin) # local bin
potentialBanner=('joke bofh' 'joke dad' 'fastfetch') potentialBanner=('joke bofh' 'joke dad' 'fastfetch')
eval "$potentialBanner[$RANDOM%$#potentialBanner+1]" eval "$potentialBanner[$RANDOM%$#potentialBanner+1]"
# disable flowcontrol
stty -ixon
# initialize completion system
source "$ZDOTDIR"/files/compinit.zsh
# antidote # antidote
{{- if eq .chezmoi.osRelease.id "endeavouros" }}
source '/usr/share/zsh-antidote/antidote.zsh'
{{- else }}
test -r "$XDG_DATA_HOME"/antidote/antidote.zsh || git clone https://github.com/mattmc3/antidote.git "$XDG_DATA_HOME"/antidote test -r "$XDG_DATA_HOME"/antidote/antidote.zsh || git clone https://github.com/mattmc3/antidote.git "$XDG_DATA_HOME"/antidote
source "$XDG_DATA_HOME"/antidote/antidote.zsh source "$XDG_DATA_HOME"/antidote/antidote.zsh
{{- end }}
zstyle ':antidote:bundle' use-friendly-names 'yes' zstyle ':antidote:bundle' use-friendly-names 'yes'
antidote load antidote load
# source files # source files
source "$ZDOTDIR"/files/evalstuff.zsh source "$ZDOTDIR"/files/evalstuff.zsh
source "$ZDOTDIR"/files/options.zsh
source "$ZDOTDIR"/files/aliases.zsh source "$ZDOTDIR"/files/aliases.zsh
source "$ZDOTDIR"/files/functions.zsh source "$ZDOTDIR"/files/functions.zsh
source "$ZDOTDIR"/files/distroicon.zsh
# completion files # completion files
source "$ZDOTDIR"/files/sshcomp.zsh source "$ZDOTDIR"/files/sshcomp.zsh
source "$ZDOTDIR"/files/bashcomps.zsh
# local overrides # local overrides
for sourced in "$XDG_DATA_HOME"/zsh/files/*; do source $sourced; done for sourced in "$XDG_DATA_HOME"/zsh/files/*; do source $sourced; done

View file

@ -1,11 +0,0 @@
if (( ${+commands[distrobox]} )); then
source /usr/share/bash-completion/completions/distrobox
source /usr/share/bash-completion/completions/distrobox-create
source /usr/share/bash-completion/completions/distrobox-enter
source /usr/share/bash-completion/completions/distrobox-ephemeral
source /usr/share/bash-completion/completions/distrobox-generate-entry
source /usr/share/bash-completion/completions/distrobox-list
source /usr/share/bash-completion/completions/distrobox-rm
source /usr/share/bash-completion/completions/distrobox-stop
source /usr/share/bash-completion/completions/distrobox-upgrade
fi

View file

@ -1,4 +0,0 @@
mkdir -p "$XDG_CACHE_HOME"/zsh &>/dev/null
autoload -Uz compinit
compinit -d "$XDG_CACHE_HOME"/zsh/compdump

View file

@ -1,33 +0,0 @@
# find out which distribution we are running on
FILE="/etc/*-release"
if [[ -f $FILE ]]; then
_distro=$(awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }')
fi
# set an icon based on the distro
case $_distro in
*kali*) ICON="ﴣ";;
*arch*|*endeavouros*) ICON="";;
*debian*) ICON="";;
*raspbian*) ICON="";;
*ubuntu*) ICON="";;
*elementary*) ICON="";;
*fedora*) ICON="";;
*coreos*) ICON="";;
*gentoo*) ICON="";;
*mageia*) ICON="";;
*centos*) ICON="";;
*opensuse*|*tumbleweed*) ICON="";;
*sabayon*) ICON="";;
*slackware*) ICON="";;
*linuxmint*) ICON="";;
*alpine*) ICON="";;
*aosc*) ICON="";;
*nixos*) ICON="";;
*devuan*) ICON="";;
*manjaro*) ICON="";;
*rhel*) ICON="";;
*) ICON="";;
esac
export DISTROICON="$ICON"

View file

@ -1,8 +1,5 @@
# evalstuff # evalstuff
_evalcache fzf --zsh
_evalcache zoxide init --cmd cd zsh _evalcache zoxide init --cmd cd zsh
_evalcache atuin init zsh _evalcache atuin init zsh
_evalcache navi widget zsh _evalcache navi widget zsh
_evalcache direnv hook zsh _evalcache direnv hook zsh
#_evalcache ntfy shell-integration
#eval "$(keychain --dir "$XDG_CACHE_HOME"/keychain --eval --quiet id_rsa)"

View file

@ -1,195 +0,0 @@
export ALIASES_FILE="$XDG_CONFIG_HOME"/aliasesrc
function mal {
# Use fzf to allow the user to select an alias from the aliases file
function _execute_alias {
local alias_to_execute=$(cut -d' ' -f2- "$ALIASES_FILE" | fzf)
# Check if the user cancelled the selection
test -z $alias_to_execute && return 1
echo "Executing alias: $alias_to_execute"
# Execute the selected alias
eval ${alias_to_execute%%=*}
return 0
}
# Delete an existing alias by selecting it from a list
function _interactive_delete {
local alias_to_delete=$(cut -d' ' -f2- "$ALIASES_FILE" | fzf)
# Check if the user cancelled the selection
test -z $alias_to_delete && return 1
echo "Deleted alias: $alias_to_delete"
# Delete the selected alias from the aliases file
sed -i "/^alias ${alias_to_delete%%=*}=/d" "$ALIASES_FILE"
unalias ${alias_to_delete%%=*}
}
# Delete an existing alias using specified name
function _parameter_delete {
local alias_to_delete=$1
local line_with_alias=$(grep "$1=" "$ALIASES_FILE")
# Check if the alias exists in the aliases file
if test -z "$line_with_alias"; then
echo "No alias with the name $1 found."
return 2
fi
echo "Deleted alias: $alias_to_delete"
# Delete the selected alias from the aliases file
sed -i "/^alias ${alias_to_delete%%=*}=/d" "$ALIASES_FILE"
unalias ${alias_to_delete%%=*}
}
# Rename an existing alias by selecting it from a list
function _interactive_rename {
local alias_to_rename=$(cut -d' ' -f2- "$ALIASES_FILE" | fzf)
# Check if the user cancelled the selection
test -z $alias_to_rename && return 1
echo "Input new name:"
read new_name
echo "Renaming alias from $alias_to_rename to $new_name"
sed -i "s/^alias ${alias_to_rename%%=*}=/alias ${new_name}=/g" "$ALIASES_FILE"
unalias ${alias_to_rename%%=*}
}
# Rename an existing alias using specified old and new names
function _parameter_rename {
local old_alias_name=$1
local new_alias_name=$2
local line_with_alias=$(grep "^alias ${old_alias_name}=" "$ALIASES_FILE")
if test -z "$line_with_alias"; then
echo "No alias with the name $old_alias_name found."
return 1
fi
echo "Renaming alias from $old_alias_name to $new_alias_name"
sed -i "s/^alias ${old_alias_name}=/alias ${new_alias_name}=/g" "$ALIASES_FILE"
unalias ${old_alias_name}
}
# Change the command associated with an existing alias by selecting it from a list
function _interactive_command_change {
local alias_to_change=$(cut -d' ' -f2- "$ALIASES_FILE" | fzf)
# Check if the user cancelled the selection
test -z $alias_to_change && return 1
echo "Input new command:"
read new_command
echo "Changing command for alias ${alias_to_change%%=*} to \"$new_command\""
sed -i "/^alias ${alias_to_change%%=*}=/{s/=.*/=\"$new_command\"/}" "$ALIASES_FILE"
}
# Change the command associated with an existing alias using specified name and command
function _parameter_command_change {
local alias_to_change=$1
local new_command="${@:2}"
local line_with_alias=$(grep "$alias_to_change=" "$ALIASES_FILE")
if test -z "$line_with_alias"; then
echo "No alias with the name $alias_to_change found."
return 1
fi
echo "Changing command for alias $alias_to_change to \"$new_command\""
sed -i "/^alias ${alias_to_change}=/{s/=.*/=\"$new_command\"/}" "$ALIASES_FILE"
}
# Add a new alias
function _add_command {
local line_with_alias=$(grep "$1=" "$ALIASES_FILE")
if test ! -z "$line_with_alias"; then
echo "Alias found: $line_with_alias; change alias by using the -c flag."
return 1
fi
local lh="alias $1"
local rh=\"${@:2}\"
local alias_str="$lh=$rh"
echo $alias_str >>"$ALIASES_FILE"
echo "added '$alias_str' to .aliases"
}
# List all aliases from the aliases file
function _list_aliases {
cut -d' ' -f2- "$ALIASES_FILE" | command cat
}
# ==============================================================================================================================================================
action="$1"
param1="$2"
param2="$3"
# Check if the user has provided a help option or no arguments
helpParams=('-h' '--help' '-help')
if (($helpParams[(Ie)$action])) || test $# -eq 0; then
# Display usage information
echo "Usage: mal [OPTION]... [ALIAS_NAME] [ALIAS_COMMAND]..."
echo ""
echo "Create, delete, change, or execute aliases interactively."
echo ""
echo "Options:"
echo " -h, --help display this help and exit"
echo " -l list all defined aliases"
echo " -e execute an alias interactively"
echo " -d delete an alias interactively"
echo " -dn NAME delete an alias by name"
echo " -r rename an alias interactively"
echo " -rn OLD NEW rename an existing alias"
echo " -c change the command associated with an existing alias interactively"
echo " -cc NAME COMMAND change the command associated with an existing alias by name"
return 0
fi
case "$action" in
"-e")
# Execute an alias interactively
_execute_alias
;;
"-l")
# List all aliases
_list_aliases
;;
"-d")
# Delete an alias interactively
_interactive_delete
;;
"-dn")
# Delete an alias using a parameter
_parameter_delete "$param1"
;;
"-r")
# rename an alias interactively
_interactive_rename
;;
"-rn")
# rename an alias using parameters
_parameter_rename "$param1" "$param2"
;;
"-c")
# change a command interactively
_interactive_command_change
;;
"-cc")
# change a command using parameters
_parameter_command_change "$param1" "$param2"
;;
*)
# add a new command
_add_command "$action" "$param1"
;;
esac
# Reload aliases
source "$ALIASES_FILE"
}

View file

@ -1,5 +0,0 @@
setopt NO_CLOBBER
setopt INTERACTIVE_COMMENTS
setopt HASH_EXECUTABLES_ONLY
setopt NUMERIC_GLOB_SORT
unsetopt FLOW_CONTROL