some changes

This commit is contained in:
pika 2024-08-16 14:51:56 +02:00
parent 4b60c50202
commit 5a11540bf8
2 changed files with 495 additions and 486 deletions

30
.bashrc
View file

@ -9,10 +9,10 @@ function echo_info() { echo -e "\033[0;35m${*}\033[0m"; }
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
# case $- in
# *i*) ;;
# *) return ;;
# esac
_defaults_() {
# don't put duplicate lines or lines starting with space in the history.
@ -269,15 +269,6 @@ _cat_() {
fi
}
_fzf_() {
if command_exists fzf; then
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)"
source ./fzf-bash-completion.sh
bind -x '"\t": fzf_bash_completion'
fi
}
_fetches_() {
# ─< fastfetch >────────────────────────────────────────────────────────────────────────────
if command_exists fastfetch; then
@ -289,9 +280,7 @@ _fetches_() {
git clone https://git.k4li.de/mirrors/fastfetch.git $HOME/.local/share/fastfetch >/dev/null 2>&1
exec $SHELL
fi
clear &
f
alias clear="clear & f"
alias clear="clear & ff"
fi
}
@ -386,9 +375,11 @@ get_packager() {
refresh="nala update"
remove="nala remove"
purge="nala purge"
search="nala search"
alias update="$_sudo $refresh && $_sudo $upgrade"
alias install="$_sudo $refresh && $_sudo $install"
alias remove="$_sudo $remove && $_sudo $purge && $_sudo $clean"
alias search="$search"
elif command_exists apt-get; then
PKG="apt-get"
install="apt-get install --yes"
@ -397,9 +388,11 @@ get_packager() {
clean="apt-get autoremove"
remove="apt-get remove"
purge="apt-get purge"
search="apt-cache search"
alias update="$_sudo $refresh && $_sudo $upgrade"
alias install="$_sudo $refresh && $_sudo $install"
alias remove="$_sudo $remove && $_sudo $purge && $_sudo $clean"
alias search="$search"
fi
;;
arch | manjaro | endevouros)
@ -408,16 +401,19 @@ get_packager() {
alias install="yay -S --noconfirm"
alias update="yay -Syu"
alias remove="yay -R"
alias search="yay -Ss"
elif command_exists paru; then
PKG="paru"
alias install="paru -S --noconfirm"
alias update="paru -Syu"
alias remove="paru -R"
alias search="paru -Ss"
elif command_exists pacman; then
PKG="pacman"
alias install="$_sudo pacman -S --noconfirm"
alias update="$_sudo pacman -Syu"
alias remove="$_sudo pacman -R"
alias search="$_sudo pacman -Ss"
fi
;;
fedora | centos)
@ -425,6 +421,7 @@ get_packager() {
alias install="dnf install --yes"
alias update="dnf update"
alias remove="dnf remove"
alias search="dnf search"
;;
alpine)
PKG="apk"
@ -445,7 +442,6 @@ get_alias() {
_color_prompt_
_cli_qol_
_cat_
# _fzf_
_trash
_nmap_
_tmux_

View file

@ -142,11 +142,12 @@ _fzf_bash_completion_unquote_strings() {
}
_fzf_bash_completion_parse_line() {
_fzf_bash_completion_shell_split \
| _fzf_bash_completion_parse_dq \
| _fzf_bash_completion_flatten_subshells \
| tr \\n \\0 \
| "$_fzf_bash_completion_sed" -r "$(cat <<'EOF'
_fzf_bash_completion_shell_split |
_fzf_bash_completion_parse_dq |
_fzf_bash_completion_flatten_subshells |
tr \\n \\0 |
"$_fzf_bash_completion_sed" -r "$(
cat <<'EOF'
# collapse newlines
s/\x00\x00/\x00/g;
# leave trailing space
@ -162,8 +163,8 @@ s/^(.*[\x00\n])?(\[\[|case|do|done|elif|else|esac|fi|for|function|if|in|select|t
# remove ENVVAR=VALUE
s/^(\s*[\n\x00]|\w+=[^\n\x00]*[\n\x00])*//
EOF
)" \
| tr \\0 \\n
)" |
tr \\0 \\n
}
_fzf_bash_completion_compspec() {
@ -290,8 +291,8 @@ fzf_bash_completion() {
_fzf_bash_completion_selector() {
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" \
$(__fzfcmd 2>/dev/null || echo fzf) -1 -0 --prompt "${FZF_TAB_COMPLETION_PROMPT:-> }$line" --nth 2 -d "$_FZF_COMPLETION_SEP" --ansi \
| tr -d "$_FZF_COMPLETION_SEP"
$(__fzfcmd 2>/dev/null || echo fzf) -1 -0 --prompt "${FZF_TAB_COMPLETION_PROMPT:-> }$line" --nth 2 -d "$_FZF_COMPLETION_SEP" --ansi |
tr -d "$_FZF_COMPLETION_SEP"
}
_fzf_bash_completion_expand_alias() {
@ -377,9 +378,9 @@ fzf_bash_completer() {
_fzf_bash_completion_complete "$@"
done
printf '%s\n' "$_FZF_COMPLETION_SEP$_fzf_sentinel1$_fzf_sentinel2"
) | $_fzf_bash_completion_sed -un "/$_fzf_sentinel1$_fzf_sentinel2/q; p" \
| _fzf_bash_completion_auto_common_prefix "$raw_cur" \
| _fzf_bash_completion_unbuffered_awk '$0!="" && !x[$0]++' '$0 = "\x1b[37m" substr($0, 1, len) "\x1b[0m" sep substr($0, len+1)' -vlen="${#raw_cur}" -vsep="$_FZF_COMPLETION_SEP"
) | $_fzf_bash_completion_sed -un "/$_fzf_sentinel1$_fzf_sentinel2/q; p" |
_fzf_bash_completion_auto_common_prefix "$raw_cur" |
_fzf_bash_completion_unbuffered_awk '$0!="" && !x[$0]++' '$0 = "\x1b[37m" substr($0, 1, len) "\x1b[0m" sep substr($0, len+1)' -vlen="${#raw_cur}" -vsep="$_FZF_COMPLETION_SEP"
)
local coproc_pid="$COPROC_PID"
value="$(_fzf_bash_completion_selector "$1" "$raw_cur" "$3" <&"${COPROC[0]}")"
@ -424,31 +425,40 @@ _fzf_bash_completion_complete() {
case "$1" in
-F)
local compl_function="$2"
shift ;;
shift
;;
-C)
local compl_command="$2"
shift ;;
shift
;;
-G)
local compl_globpat="$2"
shift ;;
shift
;;
-W)
local compl_wordlist="$2"
shift ;;
shift
;;
-X)
local compl_xfilter="$2"
shift ;;
shift
;;
-o)
_fzf_bash_completion_compopt -o "$2"
shift ;;
shift
;;
-A)
local compgen_opts+=("$1" "$2")
shift ;;
shift
;;
-P)
local compl_prefix="$(_fzf_bash_completion_awk_escape "$2")"
shift ;;
shift
;;
-S)
local compl_suffix="$(_fzf_bash_completion_awk_escape "$2")"
shift ;;
shift
;;
-[a-z])
compgen_actions+=("$1")
;;
@ -508,10 +518,13 @@ _fzf_bash_completion_complete() {
fi
printf '\n'
) | _fzf_bash_completion_apply_xfilter "$compl_xfilter" \
| _fzf_bash_completion_unbuffered_awk '$0!=""' 'sub(find, replace)' -vfind='.*' -vreplace="$(printf %s "$compl_prefix" | "$_fzf_bash_completion_sed" 's/[&\]/\\&/g')&$(printf %s "$compl_suffix" | "$_fzf_bash_completion_sed" 's/[&\]/\\&/g')" \
| if IFS= read -r line || (( ${#COMPREPLY[@]} )); then
([[ -z "$line" ]] || printf '%s\n' "$line"; cat) | _fzf_bash_completion_quote_filenames "$@"
) | _fzf_bash_completion_apply_xfilter "$compl_xfilter" |
_fzf_bash_completion_unbuffered_awk '$0!=""' 'sub(find, replace)' -vfind='.*' -vreplace="$(printf %s "$compl_prefix" | "$_fzf_bash_completion_sed" 's/[&\]/\\&/g')&$(printf %s "$compl_suffix" | "$_fzf_bash_completion_sed" 's/[&\]/\\&/g')" |
if IFS= read -r line || ((${#COMPREPLY[@]})); then
(
[[ -z "$line" ]] || printf '%s\n' "$line"
cat
) | _fzf_bash_completion_quote_filenames "$@"
else
# got no results
local compgen_opts=()
@ -522,19 +535,19 @@ _fzf_bash_completion_complete() {
if [ -n "${compgen_opts[*]}" ]; then
# these are all filenames
printf 'compl_filenames=1\n' >&"${__evaled}"
compgen "${compgen_opts[@]}" -- "$2" \
| compl_filenames=1 _fzf_bash_completion_quote_filenames "$@" \
| _fzf_bash_completion_dir_marker
compgen "${compgen_opts[@]}" -- "$2" |
compl_filenames=1 _fzf_bash_completion_quote_filenames "$@" |
_fzf_bash_completion_dir_marker
fi
fi
if [ "$compl_plusdirs" = 1 ]; then
compgen -o dirnames -- "$2" \
| compl_filenames=1 _fzf_bash_completion_quote_filenames "$@" \
| _fzf_bash_completion_dir_marker
compgen -o dirnames -- "$2" |
compl_filenames=1 _fzf_bash_completion_quote_filenames "$@" |
_fzf_bash_completion_dir_marker
fi
) \
| "$dir_marker"
) |
"$dir_marker"
}
_fzf_bash_completion_apply_xfilter() {