diff options
Diffstat (limited to 'fedora/.local')
24 files changed, 1006 insertions, 123 deletions
diff --git a/fedora/.local/bin/bat b/fedora/.local/bin/bat Binary files differnew file mode 100755 index 0000000..f9846c7 --- /dev/null +++ b/fedora/.local/bin/bat diff --git a/fedora/.local/bin/bmshortcuts b/fedora/.local/bin/bmshortcuts index c425b2f..af4ad58 100755 --- a/fedora/.local/bin/bmshortcuts +++ b/fedora/.local/bin/bmshortcuts @@ -10,7 +10,13 @@ zsh_named_dirs="${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc" command -v lf && lf_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/lf/shortcutrc" || lf_shortcuts="/dev/null" command -v vim && vim_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/vim/shortcuts.vim" || vim_shortcuts="/dev/null" command -v nvim && nvim_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/nvim/shortcuts.lua" || nvim_shortcuts="/dev/null" -command -v yazi && yazi_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/keymap.toml" || yazi_shortcuts="/dev/null" +if command -v yazi; then + yazi_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/keymap.toml" + yazi_shortcuts_tmp="$yazi_shortcuts.tmp" +else + yazi_shortcuts="/dev/null" + yazi_shortcuts_tmp="/dev/null" +fi command -v ranger && ranger_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/ranger/shortcuts.conf" || ranger_shortcuts="/dev/null" command -v qutebrowser && qute_shortcuts="$HOME/.qutebrowser/shortcuts.py" || qute_shortcuts="/dev/null" command -v fish && fish_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/fish/shortcuts.fish" || fish_shortcuts="/dev/null" @@ -43,7 +49,7 @@ eval "echo \"$(cat "$bmdirs")\"" | printf(\"vim.keymap.set('n', '<localleader><localleader>%s', function() require('mini.files').open('%s') end, { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, desc_path) >> \"$nvim_shortcuts\" ; desc_path = \$2; gsub(\"^/home/$USER/\",\"~/\",desc_path); key_array = \"\"; for(i=1; i<=length(\$1); i++) { if(i==1) key_array = \"\\\"\" substr(\$1,i,1) \"\\\"\"; else key_array = key_array \", \\\"\" substr(\$1,i,1) \"\\\"\" } - printf(\"\\t{ on = [ %s ], run = \\\"cd %s\\\", desc = \\\"Go to %s\\\" },\\n\",key_array,\$2,desc_path) >> \"$yazi_shortcuts.tmp\"}" + printf(\"\\t{ on = [ %s ], run = \\\"cd %s\\\", desc = \\\"Go to %s\\\" },\\n\",key_array,\$2,desc_path) >> \"$yazi_shortcuts_tmp\"}" # Format the `files` file in the correct syntax and sent it to both configs. eval "echo \"$(cat "$bmfiles")\"" | @@ -66,10 +72,10 @@ eval "echo \"$(cat "$bmfiles")\"" | printf(\"vim.keymap.set('n', '<localleader><localleader>%s', '<cmd>e %s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, desc_path) >> \"$nvim_shortcuts\" ; desc_path = \$2; gsub(\"^/home/$USER/\",\"~/\",desc_path); key_array = \"\"; for(i=1; i<=length(\$1); i++) { if(i==1) key_array = \"\\\"\" substr(\$1,i,1) \"\\\"\"; else key_array = key_array \", \\\"\" substr(\$1,i,1) \"\\\"\" } - printf(\"\\t{ on = [ %s ], run = [ 'reveal %s', 'open' ], desc = \\\"Open %s\\\" },\\n\", key_array, \$2, desc_path) >> \"$yazi_shortcuts.tmp\" }" + printf(\"\\t{ on = [ %s ], run = [ 'reveal %s', 'open' ], desc = \\\"Open %s\\\" },\\n\", key_array, \$2, desc_path) >> \"$yazi_shortcuts_tmp\" }" # Merge bookmarks into keymap-default.toml -if [ -f "$yazi_shortcuts.tmp" ]; then +if [ -f "$yazi_shortcuts_tmp" ]; then # Find the line with the closing bracket in the [mgr] section line_num=$(grep -n "^]" "$yazi_shortcuts" | head -1 | cut -d: -f1) @@ -77,11 +83,11 @@ if [ -f "$yazi_shortcuts.tmp" ]; then head -n $((line_num - 1)) "$yazi_shortcuts" >"$yazi_shortcuts.new" echo "" >>"$yazi_shortcuts.new" echo " # Custom bookmarks" >>"$yazi_shortcuts.new" - cat "$yazi_shortcuts.tmp" >>"$yazi_shortcuts.new" + cat "$yazi_shortcuts_tmp" >>"$yazi_shortcuts.new" echo "]" >>"$yazi_shortcuts.new" tail -n +$((line_num + 1)) "$yazi_shortcuts" >>"$yazi_shortcuts.new" # Replace the original file mv "$yazi_shortcuts.new" "$yazi_shortcuts" - rm -f "$yazi_shortcuts.tmp" + rm -f "$yazi_shortcuts_tmp" fi diff --git a/fedora/.local/bin/chafa b/fedora/.local/bin/chafa Binary files differnew file mode 100755 index 0000000..89b4c96 --- /dev/null +++ b/fedora/.local/bin/chafa diff --git a/fedora/.local/bin/eza b/fedora/.local/bin/eza Binary files differnew file mode 100755 index 0000000..0d40b22 --- /dev/null +++ b/fedora/.local/bin/eza diff --git a/fedora/.local/bin/fzf b/fedora/.local/bin/fzf Binary files differnew file mode 100755 index 0000000..0e89dac --- /dev/null +++ b/fedora/.local/bin/fzf diff --git a/fedora/.local/bin/fzf-preview.sh b/fedora/.local/bin/fzf-preview.sh new file mode 100755 index 0000000..5f99697 --- /dev/null +++ b/fedora/.local/bin/fzf-preview.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +# +# The purpose of this script is to demonstrate how to preview a file or an +# image in the preview window of fzf. +# +# Dependencies: +# - https://github.com/sharkdp/bat +# - https://github.com/hpjansson/chafa +# - https://iterm2.com/utilities/imgcat + +if [[ $# -ne 1 ]]; then + >&2 echo "usage: $0 FILENAME[:LINENO][:IGNORED]" + exit 1 +fi + +file=${1/#\~\//$HOME/} + +center=0 +if [[ ! -r $file ]]; then + if [[ $file =~ ^(.+):([0-9]+)\ *$ ]] && [[ -r ${BASH_REMATCH[1]} ]]; then + file=${BASH_REMATCH[1]} + center=${BASH_REMATCH[2]} + elif [[ $file =~ ^(.+):([0-9]+):[0-9]+\ *$ ]] && [[ -r ${BASH_REMATCH[1]} ]]; then + file=${BASH_REMATCH[1]} + center=${BASH_REMATCH[2]} + fi +fi + +type=$(file --brief --dereference --mime -- "$file") + +if [[ ! $type =~ image/ ]]; then + if [[ $type =~ =binary ]]; then + file "$1" + exit + fi + + # Sometimes bat is installed as batcat. + if command -v batcat > /dev/null; then + batname="batcat" + elif command -v bat > /dev/null; then + batname="bat" + else + cat "$1" + exit + fi + + ${batname} --style="${BAT_STYLE:-numbers}" --color=always --pager=never --highlight-line="${center:-0}" -- "$file" + exit +fi + +dim=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES} +if [[ $dim == x ]]; then + dim=$(stty size < /dev/tty | awk '{print $2 "x" $1}') +elif ! [[ $KITTY_WINDOW_ID ]] && ((FZF_PREVIEW_TOP + FZF_PREVIEW_LINES == $(stty size < /dev/tty | awk '{print $1}'))); then + # Avoid scrolling issue when the Sixel image touches the bottom of the screen + # * https://github.com/junegunn/fzf/issues/2544 + dim=${FZF_PREVIEW_COLUMNS}x$((FZF_PREVIEW_LINES - 1)) +fi + +# 1. Use icat (from Kitty) if kitten is installed +if [[ $KITTY_WINDOW_ID ]] || [[ $GHOSTTY_RESOURCES_DIR ]] && command -v kitten > /dev/null; then + # 1. 'memory' is the fastest option but if you want the image to be scrollable, + # you have to use 'stream'. + # + # 2. The last line of the output is the ANSI reset code without newline. + # This confuses fzf and makes it render scroll offset indicator. + # So we remove the last line and append the reset code to its previous line. + kitten icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/' + +# 2. Use chafa with Sixel output +elif command -v chafa > /dev/null; then + chafa -s "$dim" "$file" + # Add a new line character so that fzf can display multiple images in the preview window + echo + +# 3. If chafa is not found but imgcat is available, use it on iTerm2 +elif command -v imgcat > /dev/null; then + # NOTE: We should use https://iterm2.com/utilities/it2check to check if the + # user is running iTerm2. But for the sake of simplicity, we just assume + # that's the case here. + imgcat -W "${dim%%x*}" -H "${dim##*x}" "$file" + +# 4. Cannot find any suitable method to preview the image +else + file "$file" +fi diff --git a/fedora/.local/bin/fzf-tmux b/fedora/.local/bin/fzf-tmux new file mode 100755 index 0000000..e73a908 --- /dev/null +++ b/fedora/.local/bin/fzf-tmux @@ -0,0 +1,257 @@ +#!/usr/bin/env bash +# fzf-tmux: starts fzf in a tmux pane +# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS] + +fail() { + >&2 echo "$1" + exit 2 +} + +fzf="$(command which fzf)" || fzf="$(dirname "$0")/fzf" +[[ -x $fzf ]] || fail 'fzf executable not found' + +args=() +opt="" +skip="" +swap="" +close="" +term="" +[[ -n $LINES ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}") +[[ -n $COLUMNS ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}") + +tmux_version=$(tmux -V | sed 's/[^0-9.]//g') +tmux_32=$(awk '{print ($1 >= 3.2)}' <<< "$tmux_version" 2> /dev/null || bc -l <<< "$tmux_version >= 3.2") + +help() { + >&2 echo 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS] + + LAYOUT OPTIONS: + (default layout: -d 50%) + + Popup window (requires tmux 3.2 or above): + -p [WIDTH[%][,HEIGHT[%]]] (default: 50%) + -w WIDTH[%] + -h HEIGHT[%] + -x COL + -y ROW + + Split pane: + -u [HEIGHT[%]] Split above (up) + -d [HEIGHT[%]] Split below (down) + -l [WIDTH[%]] Split left + -r [WIDTH[%]] Split right +' + exit +} + +while [[ $# -gt 0 ]]; do + arg="$1" + shift + [[ -z $skip ]] && case "$arg" in + -) + term=1 + ;; + --help) + help + ;; + --version) + echo "fzf-tmux (with fzf $("$fzf" --version))" + exit + ;; + -p* | -w* | -h* | -x* | -y* | -d* | -u* | -r* | -l*) + if [[ $arg =~ ^-[pwhxy] ]]; then + [[ $opt =~ "-E" ]] || opt="-E" + elif [[ $arg =~ ^.[lr] ]]; then + opt="-h" + if [[ $arg =~ ^.l ]]; then + opt="$opt -d" + swap="; swap-pane -D ; select-pane -L" + close="; tmux swap-pane -D" + fi + else + opt="" + if [[ $arg =~ ^.u ]]; then + opt="$opt -d" + swap="; swap-pane -D ; select-pane -U" + close="; tmux swap-pane -D" + fi + fi + if [[ ${#arg} -gt 2 ]]; then + size="${arg:2}" + else + if [[ $1 =~ ^[0-9%,]+$ ]] || [[ $1 =~ ^[A-Z]$ ]]; then + size="$1" + shift + else + continue + fi + fi + + if [[ $arg =~ ^-p ]]; then + if [[ -n $size ]]; then + w=${size%%,*} + h=${size##*,} + opt="$opt -w$w -h$h" + fi + elif [[ $arg =~ ^-[whxy] ]]; then + opt="$opt ${arg:0:2}$size" + elif [[ $size =~ %$ ]]; then + size=${size:0:${#size}-1} + if [[ $tmux_32 == 1 ]]; then + if [[ -n $swap ]]; then + opt="$opt -l $((100 - size))%" + else + opt="$opt -l $size%" + fi + else + if [[ -n $swap ]]; then + opt="$opt -p $((100 - size))" + else + opt="$opt -p $size" + fi + fi + else + if [[ -n $swap ]]; then + if [[ $arg =~ ^.l ]]; then + max=$columns + else + max=$lines + fi + size=$((max - size)) + [[ $size -lt 0 ]] && size=0 + opt="$opt -l $size" + else + opt="$opt -l $size" + fi + fi + ;; + --) + # "--" can be used to separate fzf-tmux options from fzf options to + # avoid conflicts + skip=1 + continue + ;; + *) + args+=("$arg") + ;; + esac + [[ -n $skip ]] && args+=("$arg") +done + +if [[ -z $TMUX ]]; then + "$fzf" "${args[@]}" + exit $? +fi + +# * --height option is not allowed +# * CTRL-Z is also disabled +# * fzf-tmux script is not compatible with --tmux option in fzf 0.53.0 or later +args=("${args[@]}" "--no-height" "--bind=ctrl-z:ignore" "--no-tmux") + +# Handle zoomed tmux pane without popup options by moving it to a temp window +if [[ ! $opt =~ "-E" ]] && tmux list-panes -F '#F' | grep -q Z; then + zoomed_without_popup=1 + original_window=$(tmux display-message -p "#{window_id}") + tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - '\\;' do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'") + tmux swap-pane -t $tmp_window \; select-window -t $tmp_window +fi + +set -e + +# Clean up named pipes on exit +id=$RANDOM +argsf="${TMPDIR:-/tmp}/fzf-args-$id" +fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id" +fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id" +fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id" +if tmux_win_opts=$(tmux show-options -p remain-on-exit \; show-options -p synchronize-panes 2> /dev/null); then + tmux_win_opts=($(sed '/ off/d; s/synchronize-panes/set-option -p synchronize-panes/; s/remain-on-exit/set-option -p remain-on-exit/; s/$/ \\;/' <<< "$tmux_win_opts")) + tmux_off_opts='; set-option -p synchronize-panes off ; set-option -p remain-on-exit off' +else + tmux_win_opts=($(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/')) + tmux_off_opts='; set-window-option synchronize-panes off ; set-window-option remain-on-exit off' +fi +cleanup() { + \rm -f $argsf $fifo1 $fifo2 $fifo3 + + # Restore tmux window options + if [[ ${#tmux_win_opts[@]} -gt 1 ]]; then + eval "tmux ${tmux_win_opts[*]}" + fi + + # Remove temp window if we were zoomed without popup options + if [[ -n $zoomed_without_popup ]]; then + tmux display-message -p "#{window_id}" > /dev/null + tmux swap-pane -t $original_window \; \ + select-window -t $original_window \; \ + kill-window -t $tmp_window \; \ + resize-pane -Z + fi + + if [[ $# -gt 0 ]]; then + trap - EXIT + exit 130 + fi +} +trap 'cleanup 1' SIGUSR1 +trap 'cleanup' EXIT + +envs="export TERM=$TERM " +if [[ $opt =~ "-E" ]]; then + if [[ $tmux_version == 3.2 ]]; then + FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" + elif [[ $tmux_32 == 1 ]]; then + FZF_DEFAULT_OPTS="--border $FZF_DEFAULT_OPTS" + opt="-B $opt" + else + echo "fzf-tmux: tmux 3.2 or above is required for popup mode" >&2 + exit 2 + fi +fi +envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")" +envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")" +envs="$envs FZF_DEFAULT_OPTS_FILE=$(printf %q "$FZF_DEFAULT_OPTS_FILE")" +[[ -n $RUNEWIDTH_EASTASIAN ]] && envs="$envs RUNEWIDTH_EASTASIAN=$(printf %q "$RUNEWIDTH_EASTASIAN")" +[[ -n $BAT_THEME ]] && envs="$envs BAT_THEME=$(printf %q "$BAT_THEME")" +echo "$envs;" > "$argsf" + +# Build arguments to fzf +opts=$(printf "%q " "${args[@]}") + +pppid=$$ +echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" >> $argsf +close="; trap - EXIT SIGINT SIGTERM $close" + +export TMUX=$(cut -d , -f 1,2 <<< "$TMUX") +mkfifo -m o+w $fifo2 +if [[ $opt =~ "-E" ]]; then + cat $fifo2 & + if [[ -n $term ]] || [[ -t 0 ]]; then + cat <<< "\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >> $argsf + else + mkfifo $fifo1 + cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; out=\$? $close; exit \$out" >> $argsf + cat <&0 > $fifo1 & + fi + + tmux popup -d "$PWD" $opt "bash $argsf" > /dev/null 2>&1 + exit $? +fi + +mkfifo -m o+w $fifo3 +if [[ -n $term ]] || [[ -t 0 ]]; then + cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf +else + mkfifo $fifo1 + cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf + cat <&0 > $fifo1 & +fi +tmux \ + split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \ + $tmux_off_opts \ + > /dev/null 2>&1 || { + "$fzf" "${args[@]}" + exit $? +} +cat $fifo2 +exit "$(cat $fifo3)" diff --git a/fedora/.local/bin/fzffiles b/fedora/.local/bin/fzffiles new file mode 100755 index 0000000..97047e9 --- /dev/null +++ b/fedora/.local/bin/fzffiles @@ -0,0 +1,99 @@ +#!/bin/sh + +# The set -e option instructs sh to immediately exit if any command has a non-zero exit status +set -e + +# Set new line and tab for word splitting +IFS=' +' + +# Get the list of selected files with key bindings for specific paths +files=$(fzf-tmux \ + --header "^a pwd ^b public ^d .dotfiles ^f configs ^g git ^h home ^k desktop ^r scripts ^s suckless ^u staged files ^v private ^/ help" \ + --preview "selection={}; + clean=\$(printf '%s' \"\$selection\" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^❓ //'); + [ -z \"\$clean\" ] && { echo 'No selection'; exit 0; } + target=\$(readlink -f \"\$clean\" 2>/dev/null || printf '%s' \"\$clean\"); + if [ -z \"\$target\" ]; then + echo 'Could not resolve path'; + exit 0; + fi + if [ -f \"\$target\" ]; then + dir=\$(dirname \"\$target\"); + if git_root=\$(git -C \"\$dir\" rev-parse --show-toplevel 2>/dev/null); then + rel=\${target#\"\$git_root\"/}; + diff_output=\$(git -C \"\$git_root\" diff --color -- \"\$rel\"); + if [ -n \"\$diff_output\" ]; then + printf '%s\n' \"\$diff_output\" + exit 0 + fi + diff_output=\$(git -C \"\$git_root\" diff --color --cached -- \"\$rel\"); + if [ -n \"\$diff_output\" ]; then + printf '%s\n' \"\$diff_output\" + exit 0 + fi + fi + fi + if [ -d \"\$target\" ]; then + exa --color=always --long --all --header --icons --git \"\$target\" + elif [ -f \"\$target\" ]; then + bat --color=always --style=header,grid --line-range=:500 \"\$target\" + else + file -h \"\$target\" + fi" \ + --reverse \ + --query="$1" \ + --multi \ + --exit-0 \ + --prompt " 💡 " \ + --bind "ctrl-a:change-prompt( ⚡ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $PWD)" \ + --bind "ctrl-b:change-prompt( 🌎 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_PUBLICSHARE_DIR:-${HOME}/Public})" \ + --bind "ctrl-d:change-prompt( ⚙️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DOTFILES_DIR:-${HOME}/.dotfiles})" \ + --bind "ctrl-f:change-prompt( 🗂️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_CONFIG_HOME:-${HOME}/.config})" \ + --bind "ctrl-g:change-prompt( )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private/repos $HOME/Public/repos)" \ + --bind "ctrl-h:change-prompt( 🏠 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME)" \ + --bind "ctrl-k:change-prompt( 🖥️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DESKTOP_DIR:-${HOME}/Desktop})" \ + --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin})" \ + --bind "ctrl-s:change-prompt( 🛠 )+reload(find ${XDG_SOURCES_HOME:-${HOME}/.local/src}/suckless -maxdepth 2 -type f -not -path '*/.git/*')" \ + --bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then top=\$(git rev-parse --show-toplevel 2>/dev/null); git -C \"\$top\" status --porcelain | awk -v root=\"\$top\" '{ + staged=substr(\$0,1,1); + unstaged=substr(\$0,2,1); + file=substr(\$0,4); + gsub(/^ +/, \"\", file); + if (file == \"\") next; + if (staged == \"?\" && unstaged == \"?\") icon=\"📄\"; + else if (staged == \"!\" && unstaged == \"!\") icon=\"❌\"; + else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🔀\"; + else if (staged != \" \" && staged != \"?\") icon=\"✅\"; + else if (unstaged != \" \") icon=\"✏️\"; + else icon=\"❓\"; + print icon \" \" root \"/\" file + }'; else echo 'This is not a git repository.'; fi)" \ + --bind "ctrl-v:change-prompt( 🔒 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private)" \ + --bind 'ctrl-/:change-prompt( ❓ )+reload(echo "^a all +^b public +^c configs +^d .dotfiles +^g git +^k desktop +^r scripts +^s suckless +^u staged files +^v private +^/ help")') + +# Check if any files were selected, and exit if not +[ -z "$files" ] && exit 0 + +files=$(printf '%s\n' "$files" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^❓ //') + +if [ -d "$files" ]; then + absolute_files=$(realpath $files) + if echo "$absolute_files" | while read -r file; do file --mime-type "$file" | grep -q 'video/'; done; then + mpv --quiet --loop $absolute_files + else + openfiles "$absolute_files" + fi +else + openfiles "$files" +fi diff --git a/fedora/.local/bin/fzffns b/fedora/.local/bin/fzffns new file mode 100755 index 0000000..c919723 --- /dev/null +++ b/fedora/.local/bin/fzffns @@ -0,0 +1,74 @@ +#!/bin/sh + +# Print all functions and comments in a readable format +# Set the filename of the script containing the functions +file="${ZDOTDIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/zsh}/scripts.zsh" + +# Initialize an empty variable to hold functions, aliases, and comments +functions="" + +# Parse the file for function names, aliases, and comments +while IFS= read -r line || [ -n "$line" ]; do + case "$line" in + \#*) + if [ "$(printf '%s' "$line" | cut -c 2)" != "#" ] && [ "$(printf '%s' "$line" | cut -c 2)" != "!" ]; then + # Remove the '#' from the comment line + comment=$(printf '%s' "$line" | sed 's/^# //') + + # Read the next line to check for alias or function definition + IFS= read -r next_line || break + + # Check if it's an alias definition + if echo "$next_line" | grep -q '^alias '; then + alias_name=$(echo "$next_line" | sed -n 's/^alias \([a-zA-Z0-9_]*\)=.*$/\1/p') + + # Read another line to get the function definition + IFS= read -r func_line || break + f_name=$(printf '%s' "$func_line" | sed -n 's/^function \([^(]*\)().*$/\1/p') + + if [ -n "$f_name" ]; then + functions="$functions$f_name|$alias_name|$comment\n" + fi + + # Check if it's a function definition + elif echo "$next_line" | grep -q '^function '; then + f_name=$(printf '%s' "$next_line" | sed -n 's/^function \([^(]*\)().*$/\1/p') + if [ -n "$f_name" ]; then + functions="$functions$f_name||$comment\n" + fi + fi + fi + ;; + esac +done <"$file" + +# Sort the functions alphabetically by name +sorted=$(printf '%b' "$functions" | sort) + +# Print out the sorted functions with aliases and comments in a readable format +formatted=$(printf '%b' "$sorted" | while IFS='|' read -r f_name alias_name comment; do + if [ -n "$alias_name" ]; then + printf 'fn: %-30s - %s (alias: %s)\n' "$f_name" "$comment" "$alias_name" + else + printf 'fn: %-30s - %s\n' "$f_name" "$comment" + fi +done) + +# Use fzf to select a function +selected=$(printf '%b' "$formatted" | fzf-tmux --header "Select a function:" --reverse) + +# Check if a function was selected +if [ -n "$selected" ]; then + # Extract the function name + f_name=$(echo "$selected" | cut -d ' ' -f 2 | sed 's/[[:space:]]\+//g') + + # Get the line number of the function definition + line_number=$(grep -n "^function $f_name(" "$file" | cut -d ':' -f 1) + + # Open the function in nvim at the specific line number + if [ -n "$line_number" ]; then + nvim "+$line_number" "$file" + else + echo "Function '$f_name' not found in $file." + fi +fi diff --git a/fedora/.local/bin/fzfpass b/fedora/.local/bin/fzfpass new file mode 100755 index 0000000..5190f8e --- /dev/null +++ b/fedora/.local/bin/fzfpass @@ -0,0 +1,88 @@ +#!/bin/sh + +set -e + +usage() { + echo "Find pass gpg files in Password-Store using fzf." + echo "" + echo "Usage: ${0##*/} [-h|--help]" + echo "" + echo "Options:" + echo " -h, --help : Show this message" + echo "" + echo "Shortcuts:" + echo " return - echo password and copy to clipboard (wayland only)" + echo " ctrl+a - new password (named as per the prompt)" + echo " ctrl+e - edit selected password" + echo " ctrl+g - regenerate selected password" + echo " ctrl+r - rename selected password" + echo " ctrl+x - delete selected password" + echo " tab - tab complete" + echo " esc/ctrl+c - exit" + exit 0 +} + +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + usage +fi + +passdir=${PASSWORD_STORE_DIR:-$HOME/.local/share/.password-store} +cd "$passdir" + +# Unlock the password for this session +pass show "$(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g' | sed 's/^..//' | head -n 1)" >/dev/null + +# Main fzf session +passfile=$( + tree -Ffi | grep '.gpg' | sed 's/.gpg$//g' | sed 's/^..//' | + fzf-tmux \ + --header="🔑 Password Manager" \ + --reverse \ + --no-mouse \ + --preview="pass {}" \ + --header="🔑 ^a: Generate | ^e: Edit | ^g: Generate (no symbol) | ^r: Rename | ^s: Generate (symbol) | ^x: Delete | tab: Replace" \ + --bind="ctrl-a:execute(if [ -z {q} ]; then read -p \"Can't generate empty password. Press enter to continue...\"; else pass generate -n {q} < /dev/tty > /dev/tty 2>&1 && pass edit {q} < /dev/tty > /dev/tty 2>&1; fi)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="ctrl-e:execute(pass edit {} < /dev/tty > /dev/tty 2>&1)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="ctrl-r:execute(bash -c ' +echo -n \"Enter new name for {}: \" > /dev/tty; +read new_name < /dev/tty; +if [ -n \"\$new_name\" ]; then + pass mv {} \"\$new_name\" || echo \"Rename failed.\" > /dev/tty; +else + echo \"No name entered. Rename aborted.\" > /dev/tty; +fi' < /dev/tty > /dev/tty 2>&1)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="ctrl-g:execute(if [ -z {} ]; then read -p \"Can't generate empty password. Press enter to continue...\"; else pass generate -in {} < /dev/tty > /dev/tty 2>&1 && pass edit {} < /dev/tty > /dev/tty 2>&1; fi)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="ctrl-s:execute(if [ -z {} ]; then read -p \"Can't generate empty password. Press enter to continue...\"; else pass generate -i {} < /dev/tty > /dev/tty 2>&1 && pass edit {} < /dev/tty > /dev/tty 2>&1; fi)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="ctrl-x:execute(pass rm {} < /dev/tty > /dev/tty 2>&1)+reload(tree -Ffi | grep '.gpg' | sed 's/.gpg$//g')" \ + --bind="tab:replace-query" +) + +show_passdata=false + +if [ "$1" = "-i" ]; then + show_passdata=true + shift +fi + +if [ "$show_passdata" = true ]; then + passdata="$(pass "$passfile")" + echo "$passdata" +else + password="$(pass show "$passfile" | head -n 1)" + echo "$password" + + if [ -n "$password" ]; then + case "$(uname)" in + Darwin*) + printf "%s" "$password" | pbcopy # Use pbcopy on macOS + ;; + Linux*) + printf "%s" "$password" | xclip -selection clipboard # Use xclip on Linux + ;; + *) + echo "Unsupported operating system" + ;; + esac + sleep 0.1 + fi +fi diff --git a/fedora/.local/bin/imgcat b/fedora/.local/bin/imgcat new file mode 100755 index 0000000..af50702 --- /dev/null +++ b/fedora/.local/bin/imgcat @@ -0,0 +1,274 @@ +#!/usr/bin/env bash + +set -o pipefail + +# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux; +# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It +# only accepts ESC backslash for ST. We use TERM instead of TMUX because TERM +# gets passed through ssh. +function print_osc() { + if [[ $TERM == screen* || $TERM == tmux* ]]; then + printf "\033Ptmux;\033\033]" + else + printf "\033]" + fi +} + +# More of the tmux workaround described above. +function print_st() { + if [[ $TERM == screen* || $TERM == tmux* ]]; then + printf "\a\033\\" + else + printf "\a" + fi +} + +function load_version() { + if [ -z ${IMGCAT_BASE64_VERSION+x} ]; then + IMGCAT_BASE64_VERSION=$(base64 --version 2>&1) + export IMGCAT_BASE64_VERSION + fi +} + +function b64_encode() { + load_version + if [[ $IMGCAT_BASE64_VERSION =~ GNU ]]; then + # Disable line wrap + base64 -w0 + else + base64 + fi +} + +function b64_decode() { + load_version + if [[ $IMGCAT_BASE64_VERSION =~ fourmilab ]]; then + BASE64ARG=-d + elif [[ $IMGCAT_BASE64_VERSION =~ GNU ]]; then + BASE64ARG=-di + else + BASE64ARG=-D + fi + base64 $BASE64ARG +} + +# print_image filename inline base64contents print_filename width height preserve_aspect_ratio +# filename: Filename to convey to client +# inline: 0 or 1, if set to 1, the file will be displayed inline, otherwise, it will be downloaded +# base64contents: Base64-encoded contents +# print_filename: 0 or 1, if set to 1, print the filename after outputting the image +# width: set output width of the image in character cells, pixels or percent +# height: set output height of the image in character cells, pixels or percent +# preserve_aspect_ratio: 0 or 1, if set to 1, fill the specified width and height as much as possible without stretching the image +# file: Empty string or file type like "application/json" or ".js". +# legacy: 1 to send one giant control sequence, 0 to send many small control sequences. +function print_image() { + # Send metadata to begin transfer. + print_osc + printf "1337;" + if [[ "$9" -eq 1 ]]; then + printf "File" + else + printf "MultipartFile" + fi + printf "=inline=%s" "$2" + printf ";size=%d" $(printf "%s" "$3" | b64_decode | wc -c) + [ -n "$1" ] && printf ";name=%s" "$(printf "%s" "$1" | b64_encode)" + [ -n "$5" ] && printf ";width=%s" "$5" + [ -n "$6" ] && printf ";height=%s" "$6" + [ -n "$7" ] && printf ";preserveAspectRatio=%s" "$7" + [ -n "$8" ] && printf ";type=%s" "$8" + if [[ "$9" -eq 1 ]]; then + printf ":%s" "$3" + print_st + else + print_st + + # Split into 200-byte chunks. This helps it get through tmux. + parts=$(printf "%s" "$3" | fold -w 200) + + # Send each part. + for part in $parts; do + print_osc + printf '1337;FilePart=%s' "$part" + print_st + done + + # Indicate completion + print_osc + printf '1337;FileEnd' + print_st + fi + + printf '\n' + [ "$4" == "1" ] && echo "$1" + has_image_displayed=t +} + +function error() { + errcho "ERROR: $*" +} + +function errcho() { + echo "$@" >&2 +} + +function show_help() { + errcho + errcho "Usage: imgcat [-p] [-n] [-W width] [-H height] [-r] [-s] [-u] [-t file-type] [-f] filename ..." + errcho " cat filename | imgcat [-W width] [-H height] [-r] [-s]" + errcho + errcho "Display images inline in the iTerm2 using Inline Images Protocol" + errcho + errcho "Options:" + errcho + errcho " -h, --help Display help message" + errcho " -p, --print Enable printing of filename or URL after each image" + errcho " -n, --no-print Disable printing of filename or URL after each image" + errcho " -u, --url Interpret following filename arguments as remote URLs" + errcho " -f, --file Interpret following filename arguments as regular Files" + errcho " -t, --type file-type Provides a type hint" + errcho " -r, --preserve-aspect-ratio When scaling image preserve its original aspect ratio" + errcho " -s, --stretch Stretch image to specified width and height (this option is opposite to -r)" + errcho " -W, --width N Set image width to N character cells, pixels or percent (see below)" + errcho " -H, --height N Set image height to N character cells, pixels or percent (see below)" + errcho " -l, --legacy Use legacy protocol that sends the whole image in a single control sequence" + errcho + errcho " If you don't specify width or height an appropriate value will be chosen automatically." + errcho " The width and height are given as word 'auto' or number N followed by a unit:" + errcho " N character cells" + errcho " Npx pixels" + errcho " N% percent of the session's width or height" + errcho " auto the image's inherent size will be used to determine an appropriate dimension" + errcho + errcho " If a type is provided, it is used as a hint to disambiguate." + errcho " The file type can be a mime type like text/markdown, a language name like Java, or a file extension like .c" + errcho " The file type can usually be inferred from the extension or its contents. -t is most useful when" + errcho " a filename is not available, such as whe input comes from a pipe." + errcho + errcho "Examples:" + errcho + errcho " $ imgcat -W 250px -H 250px -s avatar.png" + errcho " $ cat graph.png | imgcat -W 100%" + errcho " $ imgcat -p -W 500px -u http://host.tld/path/to/image.jpg -W 80 -f image.png" + errcho " $ cat url_list.txt | xargs imgcat -p -W 40 -u" + errcho " $ imgcat -t application/json config.json" + errcho +} + +function check_dependency() { + if ! (builtin command -V "$1" >/dev/null 2>&1); then + error "missing dependency: can't find $1" + exit 1 + fi +} + +# verify that value is in the image sizing unit format: N / Npx / N% / auto +function validate_size_unit() { + if [[ ! "$1" =~ ^(:?[0-9]+(:?px|%)?|auto)$ ]]; then + error "Invalid image sizing unit - '$1'" + show_help + exit 1 + fi +} + +## Main + +if [ -t 0 ]; then + has_stdin=f +else + has_stdin=t +fi + +# Show help if no arguments and no stdin. +if [ $has_stdin = f ] && [ $# -eq 0 ]; then + show_help + exit +fi + +check_dependency base64 +check_dependency wc +file_type="" +legacy=0 + +# Look for command line flags. +while [ $# -gt 0 ]; do + case "$1" in + -h | --h | --help) + show_help + exit + ;; + -p | --p | --print) + print_filename=1 + ;; + -n | --n | --no-print) + print_filename=0 + ;; + -W | --W | --width) + validate_size_unit "$2" + width="$2" + shift + ;; + -H | --H | --height) + validate_size_unit "$2" + height="$2" + shift + ;; + -r | --r | --preserve-aspect-ratio) + preserve_aspect_ratio=1 + ;; + -s | --s | --stretch) + preserve_aspect_ratio=0 + ;; + -l | --l | --legacy) + legacy=1 + ;; + -f | --f | --file) + has_stdin=f + is_url=f + ;; + -u | --u | --url) + check_dependency curl + has_stdin=f + is_url=t + ;; + -t | --t | --type) + file_type="$2" + shift + ;; + -*) + error "Unknown option flag: $1" + show_help + exit 1 + ;; + *) + if [ "$is_url" == "t" ]; then + encoded_image=$(curl -fs "$1" | b64_encode) || { + error "Could not retrieve image from URL $1, error_code: $?" + exit 2 + } + elif [ -r "$1" ]; then + encoded_image=$(cat "$1" | b64_encode) + else + error "imgcat: $1: No such file or directory" + exit 2 + fi + has_stdin=f + print_image "$1" 1 "$encoded_image" "$print_filename" "$width" "$height" "$preserve_aspect_ratio" "$file_type" "$legacy" + ;; + esac + shift +done + +# Read and print stdin +if [ $has_stdin = t ]; then + print_image "" 1 "$(cat | b64_encode)" 0 "$width" "$height" "$preserve_aspect_ratio" "$file_type" "$legacy" +fi + +if [ "$has_image_displayed" != "t" ]; then + error "No image provided. Check command line options." + show_help + exit 1 +fi + +exit 0 diff --git a/fedora/.local/bin/lastfiles b/fedora/.local/bin/lastfiles new file mode 100755 index 0000000..082b004 --- /dev/null +++ b/fedora/.local/bin/lastfiles @@ -0,0 +1,78 @@ +#!/bin/sh + +# Display help message +usage() { + echo "Open the most recent file or the list of old files in fzf edited by Vim." + echo "" + echo "Usage: ${0##*/} [OPTION]" + echo "" + echo "Options:" + echo " : Open the most recent old file in Vim." + echo " -h, --help : Show this help message." + echo " -l, --list : Show all recent files in Vim using fzf." + echo "" + echo "Examples:" + echo " ${0##*/} # Open the most recent file." + echo " ${0##*/} -l # Show all recent files in fzf and select to open." + exit 0 +} + +# Fetch oldfiles from Vim +get_oldfiles() { + vim -u NONE -es +'silent oldfiles' +qa 2>/dev/null | + sed 's/^[0-9]\+\s\+//' | + grep -v "^$" +} + +# List and handle oldfiles +list_oldfiles() { + oldfiles=$(get_oldfiles) + + # Exit if no oldfiles are found + [ -z "$oldfiles" ] && { + echo "No recent files found in Vim." >&2 + exit 1 + } + + case "$1" in + -h | --help) + usage + ;; + -l | --list) + valid_files=$(echo "$oldfiles" | while IFS= read -r file; do + [ -f "$file" ] && printf "%s\n" "$file" + done) + + [ -z "$valid_files" ] && { + echo "No valid files found." >&2 + exit 1 + } + + selected_files=$(echo "$valid_files" | + fzf-tmux \ + --multi \ + --preview 'bat -n --color=always --line-range=:500 {} 2>/dev/null || echo "Error previewing file"' \ + --height=70% \ + --reverse) + + [ -z "$selected_files" ] && exit 1 + + openfiles $selected_files + ;; + *) + # Open the most recent valid file + for file in $oldfiles; do + if [ -f "$file" ]; then + openfiles "$file" + exit 0 + fi + done + + echo "No valid recent files found." >&2 + exit 1 + ;; + esac +} + +# Parse command-line arguments +list_oldfiles "$@" diff --git a/fedora/.local/bin/lastvim b/fedora/.local/bin/lastvim deleted file mode 100755 index 435dfba..0000000 --- a/fedora/.local/bin/lastvim +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh - -# Display help message -usage() { - echo "Open the most recent file or the list of old files edited by vim." - echo "" - echo "Usage: ${0##*/} [OPTION]" - echo "" - echo "Options:" - echo " : Open the most recent old file in Vim." - echo " -h, --help : Show this help message." - echo " -l, --list : Show all recent files and select by number." - echo "" - echo "Examples:" - echo " ${0##*/} # Open the most recent file." - echo " ${0##*/} -l # Show all recent files and select by number." - exit 0 -} - -# Function to open files in vim -openfiles() { - files="$1" - if [ -n "$files" ]; then - # Convert newlines to spaces for vim arguments - file_args=$(echo "$files" | tr '\n' ' ') - vim $file_args - fi -} - -# List and handle oldfiles -list_oldfiles() { - # Fetch the oldfiles list from Vim - # Use vim's :oldfiles command and capture output - temp_file="/tmp/vim_oldfiles_$$.txt" - vim -u NONE -c "redir >> $temp_file | oldfiles | redir END | q" 2>/dev/null - - # Parse vim's oldfiles output (format: " 1: /path/to/file") - oldfiles=$(cat "$temp_file" 2>/dev/null | - sed -n 's/^[[:space:]]*[0-9]*:[[:space:]]*\(.*\)$/\1/p' | - grep -v '^$') - - rm -f "$temp_file" 2>/dev/null - - # Exit if no oldfiles are found - [ -z "$oldfiles" ] && { - echo "No recent files found in Vim." >&2 - exit 1 - } - - case "$1" in - -h | --help) - usage - ;; - -l | --list) - # Filter valid files first - paths_file="/tmp/vim_file_paths_$$.txt" - - echo "$oldfiles" | while IFS= read -r file; do - [ -f "$file" ] && printf "%s\n" "$file" - done >"$paths_file" - - # Count valid files - valid_count=$(wc -l <"$paths_file" 2>/dev/null | tr -d ' ') - - # Exit if no valid files exist - [ -z "$valid_count" ] || [ "$valid_count" -eq 0 ] && { - echo "No valid files found." >&2 - rm -f "$paths_file" 2>/dev/null - exit 1 - } - - # Display numbered file list - file_num=1 - while IFS= read -r file; do - printf "%d: %s\n" "$file_num" "$file" - file_num=$((file_num + 1)) - done <"$paths_file" - - echo "" - printf "Select file number (1-%d) or 'q' to quit: " "$valid_count" - read selection - - # Handle quit - [ "$selection" = "q" ] || [ "$selection" = "Q" ] && { - rm -f "$paths_file" 2>/dev/null - exit 0 - } - - # Validate selection - if [ -n "$selection" ] && [ "$selection" -ge 1 ] && [ "$selection" -le "$valid_count" ] 2>/dev/null; then - selected_file=$(sed -n "${selection}p" "$paths_file") - rm -f "$paths_file" 2>/dev/null - openfiles "$selected_file" - else - echo "Invalid selection." >&2 - rm -f "$paths_file" 2>/dev/null - exit 1 - fi - ;; - *) - # Open the most recent file - for file in $oldfiles; do - if [ -f "$file" ]; then - openfiles "$file" - exit 0 - fi - done - echo "No valid recent files found." >&2 - exit 1 - ;; - esac -} - -# Parse command-line arguments -list_oldfiles "$@" diff --git a/fedora/.local/bin/rg b/fedora/.local/bin/rg Binary files differnew file mode 100755 index 0000000..477c475 --- /dev/null +++ b/fedora/.local/bin/rg diff --git a/fedora/.local/bin/rga b/fedora/.local/bin/rga Binary files differnew file mode 100755 index 0000000..545efba --- /dev/null +++ b/fedora/.local/bin/rga diff --git a/fedora/.local/bin/rga-fzf b/fedora/.local/bin/rga-fzf Binary files differnew file mode 100755 index 0000000..7b86d75 --- /dev/null +++ b/fedora/.local/bin/rga-fzf diff --git a/fedora/.local/bin/rga-fzf-open b/fedora/.local/bin/rga-fzf-open Binary files differnew file mode 100755 index 0000000..71257cd --- /dev/null +++ b/fedora/.local/bin/rga-fzf-open diff --git a/fedora/.local/bin/rga-preproc b/fedora/.local/bin/rga-preproc Binary files differnew file mode 100755 index 0000000..c1ce02f --- /dev/null +++ b/fedora/.local/bin/rga-preproc diff --git a/fedora/.local/bin/rgafiles b/fedora/.local/bin/rgafiles index ac4471b..e8b5e72 100755 --- a/fedora/.local/bin/rgafiles +++ b/fedora/.local/bin/rgafiles @@ -17,7 +17,7 @@ usage() { echo "Examples:" echo " ${0##*/} -p TODO 'KEYWORD' # Search for 'KEYWORD' in files tagged with 'TODO' in the project directories" echo " ${0##*/} -l -p 'KEYWORD' # List files associated with the default 'PROJECT' tag and 'KEYWORD'" - echo " ${0##*/} 'KEYWORD' # Open files containing 'KEYWORD' in vim" + echo " ${0##*/} 'KEYWORD' # Open files containing 'KEYWORD' in nvim" exit 0 } @@ -86,7 +86,7 @@ list_or_open_project_files() { if [ "$list_mode" -eq 1 ]; then echo "$rga_output" else - # Otherwise, open the files with vim + # Otherwise, open the files with nvim set -- "$(printf "%s\n" "$rga_output")" openfiles "$@" fi diff --git a/fedora/.local/bin/sesh b/fedora/.local/bin/sesh Binary files differnew file mode 100755 index 0000000..0355f00 --- /dev/null +++ b/fedora/.local/bin/sesh diff --git a/fedora/.local/bin/sessionizer b/fedora/.local/bin/sessionizer new file mode 100755 index 0000000..93f32b1 --- /dev/null +++ b/fedora/.local/bin/sessionizer @@ -0,0 +1,36 @@ +#!/bin/sh + +sessionizer() { + path="$( + sesh list -d --icons | fzf-tmux \ + -p 80%,70% --no-sort --cycle --ignore-case --ansi --border=sharp --multi --reverse \ + --border-label "╢ TheSiahxyz ╟" \ + --header "^a all ^e sesh ^f zoxide ^g git ^t tmux ^u staged files ^x tmux kill M-cr open in editor ^/ help" \ + --prompt "💡 " \ + --bind "ctrl-a:change-prompt(💡 )+reload(sesh list -d -H --icons)" \ + --bind "ctrl-e:change-prompt(📑 )+reload(sesh list -d -c -H --icons)" \ + --bind "ctrl-f:change-prompt(🔎 )+reload(sesh list -d -z -H --icons)" \ + --bind "ctrl-g:change-prompt( )+reload(fd -H -d 1 -d -t d -E .Trash -E .git -E .cache . $HOME/Private/repos $HOME/Public/repos | sed 's|$HOME|~|g')" \ + --bind "ctrl-t:change-prompt(🪟 )+reload(sesh list -d -t --icons)" \ + --bind "ctrl-v:execute($EDITOR ${0})+abort" \ + --bind 'ctrl-x:execute(tmux kill-session -t "$(echo {} | cut -d" " -f2-)")+reload(sesh list -d --icons)' \ + --bind "alt-enter:execute($EDITOR {})+abort" \ + --bind 'ctrl-/:change-prompt(❓ )+reload(echo "^a all +^e sesh config +^f zoxide +^g git +^t tmux +^x tmux kill +M-cr open in editor +^/ help")' \ + --preview-window 'right:45%' \ + --preview 'sesh preview {}' + )" 2>/dev/null + + case "$path" in + ^*) sessionizer ;; + *) sesh connect "$path" >/dev/null 2>&1 && exit ;; + esac +} + +sessionizer diff --git a/fedora/.local/bin/ya b/fedora/.local/bin/ya Binary files differnew file mode 100755 index 0000000..2701e30 --- /dev/null +++ b/fedora/.local/bin/ya diff --git a/fedora/.local/bin/yazi b/fedora/.local/bin/yazi Binary files differnew file mode 100755 index 0000000..0c01561 --- /dev/null +++ b/fedora/.local/bin/yazi diff --git a/fedora/.local/bin/zoxide b/fedora/.local/bin/zoxide Binary files differnew file mode 100755 index 0000000..e7ba833 --- /dev/null +++ b/fedora/.local/bin/zoxide |
