summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-08 12:05:52 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-08 12:05:52 +0900
commit1c2ddf377fe563e8c393cc1b543cd3aa46233ece (patch)
treea1379a84656db70947b6b59ba8e0a8849e566a93
parent7d18f4cae5364ff0f4b90f88331e6519983ba3f2 (diff)
updates
-rw-r--r--ar/.config/lf/lfrc4
-rw-r--r--ar/.config/shell/aliasrc2
-rw-r--r--ar/.config/zsh/keymaps.zsh8
-rwxr-xr-xar/.local/bin/lastfiles (renamed from ar/.local/bin/lastnvim)0
-rw-r--r--fedora/.config/bash/keymaps.bash8
-rw-r--r--fedora/.config/shell/aliasrc2
-rwxr-xr-xfedora/.local/bin/fzfbin0 -> 4411544 bytes
-rwxr-xr-xfedora/.local/bin/fzf-preview.sh86
-rwxr-xr-xfedora/.local/bin/fzf-tmux257
-rwxr-xr-xfedora/.local/bin/lastfiles78
-rwxr-xr-xfedora/.local/bin/lastvim115
-rwxr-xr-xfedora/.local/bin/seshbin0 -> 8851145 bytes
-rwxr-xr-xfedora/.local/bin/sessionizer36
-rwxr-xr-xfedora/.local/bin/zoxidebin0 -> 1253856 bytes
-rw-r--r--mac/.config/lf/lfrc4
-rw-r--r--mac/.config/shell/aliasrc2
-rw-r--r--mac/.config/zsh/keymaps.zsh8
-rwxr-xr-xmac/.local/bin/lastfiles (renamed from mac/.local/bin/lastnvim)0
18 files changed, 476 insertions, 134 deletions
diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc
index 06a13b0..64416d3 100644
--- a/ar/.config/lf/lfrc
+++ b/ar/.config/lf/lfrc
@@ -432,7 +432,7 @@ cmd zi ${{
cmd follow_link %{{
lf -remote "send ${id} select '$(readlink $f)'"
}}
-cmd lastnvim ${{
+cmd lastfiles ${{
list=$(nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa)
file=$(printf "%s" "$list" | while read -r file; do
[ -f "$file" ] && printf "%s\n" "$file"
@@ -516,7 +516,7 @@ map <delete> delete; clear; save-select
map <enter> $$EDITOR "$f"
map <c-v> push :!nvim<space>
map vlf edit-config
-map vll lastnvim
+map vll lastfiles
map vln $$EDITOR "$(nvim -u NONE --headless +'lua io.write(vim.v.oldfiles[1] .. "\n")' +qa)"
# Extract
diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc
index 119a5b3..55f04e7 100644
--- a/ar/.config/shell/aliasrc
+++ b/ar/.config/shell/aliasrc
@@ -288,7 +288,7 @@ alias nlu='NVIM_APPNAME=LunarVim nvim'
alias nlv='NVIM_APPNAME=LazyVim nvim'
alias nnc='NVIM_APPNAME=NvChad nvim'
alias snv='sudo nvim'
-alias vll='lastnvim -l'
+alias vll='lastfiles -l'
alias vln='$EDITOR -c '\''execute "edit " . v:oldfiles[0] | normal ''0'\'
# nxsiv
diff --git a/ar/.config/zsh/keymaps.zsh b/ar/.config/zsh/keymaps.zsh
index efd9e04..81b3027 100644
--- a/ar/.config/zsh/keymaps.zsh
+++ b/ar/.config/zsh/keymaps.zsh
@@ -165,7 +165,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/bin/zsh}/zsh-vi-mode/zsh-vi-mode.plugin.z
bindkey -s '^F' '^ufzffiles\n'
bindkey -s '^G' '^ulf\n'
# bindkey -s '^G' '^uyazi\n'
- bindkey -s '^N' '^ulastnvim\n'
+ bindkey -s '^N' '^ulastfiles\n'
bindkey -s '^O' '^utmo\n'
bindkey -s '^P' '^ufzfpass\n'
bindkey -s '^Q' '^uhtop\n'
@@ -182,7 +182,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/bin/zsh}/zsh-vi-mode/zsh-vi-mode.plugin.z
zvm_bind_script viins '^X^F' 'gitfiles'
zvm_bind_script viins '^X^G' 'rgafiles '
zvm_bind_script viins '^X^L' 'gloac'
- zvm_bind_script viins '^X^N' 'lastnvim -l'
+ zvm_bind_script viins '^X^N' 'lastfiles -l'
# zvm_bind_script viins '^X^O' '^u\n'
zvm_bind_script viins '^X^Q' 'fpkill'
zvm_bind_script viins '^X^R' 'fgst'
@@ -312,7 +312,7 @@ else
bindkey -s '^D' '^ucdi\n'
bindkey -s '^F' '^ufzffiles\n'
bindkey -s '^G' '^ulf\n'
- bindkey -s '^N' '^ulastnvim\n'
+ bindkey -s '^N' '^ulastfiles\n'
bindkey -s '^O' '^utmo\n'
bindkey -s '^P' '^ufzfpass\n'
bindkey -s '^Q' '^uhtop\n'
@@ -326,7 +326,7 @@ else
bindkey -s '^X^F' '^ugitfiles\n'
bindkey -s '^X^G' '^urgafiles '
bindkey -s '^X^L' '^ugloac\n'
- bindkey -s '^X^N' '^ulastnvim -l\n'
+ bindkey -s '^X^N' '^ulastfiles -l\n'
# bindkey -s '^X^O' '^u\n'
bindkey -s '^X^Q' '^ufpkill\n'
bindkey -s '^X^R' '^ufgst\n'
diff --git a/ar/.local/bin/lastnvim b/ar/.local/bin/lastfiles
index b1ab6c9..b1ab6c9 100755
--- a/ar/.local/bin/lastnvim
+++ b/ar/.local/bin/lastfiles
diff --git a/fedora/.config/bash/keymaps.bash b/fedora/.config/bash/keymaps.bash
index 8335f3e..91b3cad 100644
--- a/fedora/.config/bash/keymaps.bash
+++ b/fedora/.config/bash/keymaps.bash
@@ -146,7 +146,7 @@ sudo_command_line() { pre_cmd "sudo"; }
# ---------- wrappers (u-prefix REMOVED) ----------
bc() { command -v bc >/dev/null 2>&1 && /usr/bin/env bc "$@" || printf 'bc: not found\n' >&2; }
cdi() { command -v cdi >/dev/null 2>&1 && cdi "$@" || printf 'cdi: not found\n' >&2; }
-lastvim() { command -v lastvim >/dev/null 2>&1 && lastvim "$@" || printf 'lastvim: not found\n' >&2; }
+lastfiles() { command -v lastfiles >/dev/null 2>&1 && lastfiles "$@" || printf 'lastfiles: not found\n' >&2; }
htop() { command -v htop >/dev/null 2>&1 && htop "$@" || printf 'htop: not found\n' >&2; }
sessionizer() { command -v sessionizer >/dev/null 2>&1 && sessionizer "$@" || printf 'sessionizer: not found\n' >&2; }
upd() { command -v upd >/dev/null 2>&1 && upd "$@" || printf 'upd: not found\n' >&2; }
@@ -154,7 +154,7 @@ cht() { command -v cht >/dev/null 2>&1 && cht "$@" || printf 'cht: not found\n'
ali() { command -v ali >/dev/null 2>&1 && ali "$@" || printf 'ali: not found\n' >&2; }
fD() { command -v fD >/dev/null 2>&1 && fD "$@" || printf 'fD: not found\n' >&2; }
rgafiles() { command -v rgafiles >/dev/null 2>&1 && rgafiles "$@" || printf 'rgafiles: not found\n' >&2; }
-lastvim_l() { command -v lastvim >/dev/null 2>&1 && lastvim -l || printf 'lastvim: not found\n' >&2; }
+lastfiles_l() { command -v lastfiles >/dev/null 2>&1 && lastfiles -l || printf 'lastfiles: not found\n' >&2; }
# ---------- Readline key bindings (bind -x) ----------
# basic movement
@@ -202,7 +202,7 @@ __bc() { bc -lq "$@"; }
bind -x '"\C-d":cdi'
bind -x '"\C-f":fzffiles'
bind -x '"\C-g":lf'
-bind -x '"\C-n":lastvim'
+bind -x '"\C-n":lastfiles'
bind -x '"\C-o":tmo'
bind -x '"\C-p":fzfpass'
bind -x '"\C-q":htop'
@@ -219,7 +219,7 @@ bind -x '"\C-x\C-d":fD'
bind -x '"\C-x\C-f":gitfiles'
bind -x '"\C-x\C-g":rgafiles'
bind -x '"\C-x\C-l":gloac'
-bind -x '"\C-x\C-n":lastvim_l'
+bind -x '"\C-x\C-n":lastfiles_l'
bind -x '"\C-x\C-q":fpkill'
bind -x '"\C-x\C-r":fgst'
bind -x '"\C-x\C-t":gitstagedfiles'
diff --git a/fedora/.config/shell/aliasrc b/fedora/.config/shell/aliasrc
index 7d9e652..3239603 100644
--- a/fedora/.config/shell/aliasrc
+++ b/fedora/.config/shell/aliasrc
@@ -240,7 +240,7 @@ alias v='$EDITOR'
alias v.='$EDITOR .'
alias ve='$EDITOR -c enew'
alias vis="$EDITOR '+set si'"
-alias vll='lastvim -l'
+alias vll='lastfiles -l'
alias vln='$EDITOR -c '\''execute "edit " . v:oldfiles[0] | normal ''0'\'
# ports
diff --git a/fedora/.local/bin/fzf b/fedora/.local/bin/fzf
new file mode 100755
index 0000000..0e89dac
--- /dev/null
+++ b/fedora/.local/bin/fzf
Binary files differ
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/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/sesh b/fedora/.local/bin/sesh
new file mode 100755
index 0000000..0355f00
--- /dev/null
+++ b/fedora/.local/bin/sesh
Binary files differ
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/zoxide b/fedora/.local/bin/zoxide
new file mode 100755
index 0000000..e7ba833
--- /dev/null
+++ b/fedora/.local/bin/zoxide
Binary files differ
diff --git a/mac/.config/lf/lfrc b/mac/.config/lf/lfrc
index f7cb423..c9b2d36 100644
--- a/mac/.config/lf/lfrc
+++ b/mac/.config/lf/lfrc
@@ -432,7 +432,7 @@ cmd zi ${{
cmd follow_link %{{
lf -remote "send ${id} select '$(readlink $f)'"
}}
-cmd lastnvim ${{
+cmd lastfiles ${{
list=$(nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa)
file=$(printf "%s" "$list" | while read -r file; do
[ -f "$file" ] && printf "%s\n" "$file"
@@ -516,7 +516,7 @@ map <delete> delete; clear; save-select
map <enter> $$EDITOR "$f"
map <c-v> push :!nvim<space>
map vlf edit-config
-map vll lastnvim
+map vll lastfiles
map vln $$EDITOR "$(nvim -u NONE --headless +'lua io.write(vim.v.oldfiles[1] .. "\n")' +qa)"
# Extract
diff --git a/mac/.config/shell/aliasrc b/mac/.config/shell/aliasrc
index 2163e68..6dcdf7d 100644
--- a/mac/.config/shell/aliasrc
+++ b/mac/.config/shell/aliasrc
@@ -292,7 +292,7 @@ alias nlu='NVIM_APPNAME=LunarVim nvim'
alias nlv='NVIM_APPNAME=LazyVim nvim'
alias nnc='NVIM_APPNAME=NvChad nvim'
alias snv='sudo nvim'
-alias vll='lastnvim -l'
+alias vll='lastfiles -l'
alias vln='$EDITOR -c '\''execute "edit " . v:oldfiles[0] | normal ''0'\'
# nxsiv
diff --git a/mac/.config/zsh/keymaps.zsh b/mac/.config/zsh/keymaps.zsh
index 6653e44..583b8e4 100644
--- a/mac/.config/zsh/keymaps.zsh
+++ b/mac/.config/zsh/keymaps.zsh
@@ -164,7 +164,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/bin/zsh}/zsh-vi-mode/zsh-vi-mode.plugin.z
bindkey -s '^D' '^ucdi\n'
bindkey -s '^F' '^ufzffiles\n'
bindkey -s '^G' '^uyazi\n'
- bindkey -s '^N' '^ulastnvim\n'
+ bindkey -s '^N' '^ulastfiles\n'
bindkey -s '^O' '^utmo\n'
bindkey -s '^P' '^ufzfpass\n'
bindkey -s '^Q' '^uhtop\n'
@@ -180,7 +180,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/bin/zsh}/zsh-vi-mode/zsh-vi-mode.plugin.z
zvm_bind_script viins '^X^F' 'gitfiles'
zvm_bind_script viins '^X^G' 'rgafiles '
zvm_bind_script viins '^X^L' 'gloac'
- zvm_bind_script viins '^X^N' 'lastnvim -l'
+ zvm_bind_script viins '^X^N' 'lastfiles -l'
# zvm_bind_script viins '^X^O' '^u\n'
zvm_bind_script viins '^X^Q' 'fpkill'
zvm_bind_script viins '^X^R' 'fgst'
@@ -310,7 +310,7 @@ else
bindkey -s '^D' '^ucdi\n'
bindkey -s '^F' '^ufzffiles\n'
bindkey -s '^G' '^uyazi\n'
- bindkey -s '^N' '^ulastnvim\n'
+ bindkey -s '^N' '^ulastfiles\n'
bindkey -s '^O' '^utmo\n'
bindkey -s '^P' '^ufzfpass\n'
bindkey -s '^Q' '^uhtop\n'
@@ -324,7 +324,7 @@ else
bindkey -s '^X^F' '^ugitfiles\n'
bindkey -s '^X^G' '^urgafiles '
bindkey -s '^X^L' '^ugloac\n'
- bindkey -s '^X^N' '^ulastnvim -l\n'
+ bindkey -s '^X^N' '^ulastfiles -l\n'
# bindkey -s '^X^O' '^u\n'
bindkey -s '^X^Q' '^ufpkill\n'
bindkey -s '^X^R' '^ufgst\n'
diff --git a/mac/.local/bin/lastnvim b/mac/.local/bin/lastfiles
index b1ab6c9..b1ab6c9 100755
--- a/mac/.local/bin/lastnvim
+++ b/mac/.local/bin/lastfiles