summaryrefslogtreecommitdiff
path: root/fedora/.local/bin
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-08 10:52:01 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-08 10:52:01 +0900
commit7d18f4cae5364ff0f4b90f88331e6519983ba3f2 (patch)
tree4fcf215e705fb03558ba577a809ade586c8c01f5 /fedora/.local/bin
parent0e1fcb2c62a20fb826944833db10562741d0042f (diff)
updates
Diffstat (limited to 'fedora/.local/bin')
-rwxr-xr-xfedora/.local/bin/bmshortcuts (renamed from fedora/.local/bin/shortcuts)4
-rwxr-xr-xfedora/.local/bin/bookmarks211
-rwxr-xr-xfedora/.local/bin/lastnvim77
-rwxr-xr-xfedora/.local/bin/lastvim115
-rwxr-xr-xfedora/.local/bin/openfiles12
-rwxr-xr-xfedora/.local/bin/restartvim (renamed from fedora/.local/bin/restartnvim)8
-rwxr-xr-xfedora/.local/bin/rgafiles4
-rwxr-xr-xfedora/.local/bin/tmuxopen42
8 files changed, 150 insertions, 323 deletions
diff --git a/fedora/.local/bin/shortcuts b/fedora/.local/bin/bmshortcuts
index ab5e69d..c425b2f 100755
--- a/fedora/.local/bin/shortcuts
+++ b/fedora/.local/bin/bmshortcuts
@@ -12,7 +12,7 @@ command -v vim && vim_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/vim/shortcu
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"
command -v ranger && ranger_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/ranger/shortcuts.conf" || ranger_shortcuts="/dev/null"
-command -v qutebrowser && qute_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/qutebrowser/shortcuts.py" || qute_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"
command -v vifm && vifm_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/vifm/shortcuts.rc" || vifm_shortcuts="/dev/null"
@@ -22,7 +22,7 @@ printf "# vim: filetype=sh\\n" >"$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
printf "# vim: filetype=sh\\n" >"$shell_env_shortcuts"
printf "\" vim: filetype=vim\\n" >"$vifm_shortcuts"
-cp "$HOME/.config/yazi/keymap-default.toml" "$yazi_shortcuts"
+[ -f "$HOME/.config/yazi/keymap-default.toml" ] && cp "$HOME/.config/yazi/keymap-default.toml" "$yazi_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs.
eval "echo \"$(cat "$bmdirs")\"" |
diff --git a/fedora/.local/bin/bookmarks b/fedora/.local/bin/bookmarks
deleted file mode 100755
index a892a33..0000000
--- a/fedora/.local/bin/bookmarks
+++ /dev/null
@@ -1,211 +0,0 @@
-#!/bin/sh
-
-usage() {
- echo "Open bookmarks, URLs, or browser history in a program."
- echo ""
- echo "Usage: ${0##*/} [OPTIONS]"
- echo ""
- echo "Options:"
- echo " -h : Show this message"
- echo " -b : Open a browser bookmark"
- echo " -c : Copy a URL from snippets/urls to the clipboard"
- echo " -o : Get a URL from snippets/urls and open it in a new browser window"
- echo " -p : Get a URL from snippets/urls and open it in a private browser window"
- echo " -s : Open browser history"
- echo " -t : Get a URL from snippets/urls and type it using xdotool"
- echo " -v : Open a browser bookmark in private browser window"
- echo ""
- echo "Programs:"
- echo " browser : System default browser"
- echo " lynx : A text browser for World Wide Web"
- echo " w3m : A text WWW browser, similar to lynx"
- echo ""
- echo "Examples:"
- echo " ${0##*/} -b # Opens a browser bookmark in a program"
- echo " ${0##*/} -c # Copies a URL from snippets/urls to the clipboard"
- echo " ${0##*/} -o # Opens a URL from snippets/urls in a new browser window"
- echo " ${0##*/} -p # Opens a URL in a private browser window"
- echo " ${0##*/} -s # Opens browser history in a program"
- echo " ${0##*/} -v # Opens browser boomark in private browser window"
-}
-
-addurls() {
- url=$(echo | dmenu -i -p "Enter a url: ")
- [ -z "$url" ] && printf "Error: url must be provided\n\n" && exit 0
-
- description=$(echo | dmenu -i -p "Enter a description of the url: ")
- [ -z "$description" ] && echo "https://$url" >>~/.local/share/thesiah/snippets
- [ -n "$description" ] && echo "$description https://$url" >>~/.local/share/thesiah/snippets
-}
-
-opentool() {
- available_tools=""
- command -v xdg-open 2>/dev/null | grep -v "alias" -q && available_tools="$available_tools xdg-open"
- command -v open 2>/dev/null | grep -v "alias" -q && available_tools="$available_tools open"
- command -v lynx 2>/dev/null | grep -v "alias" -q && available_tools="$available_tools lynx"
- command -v w3m 2>/dev/null | grep -v "alias" -q && available_tools="$available_tools w3m"
- available_tools=$(printf "%s" "$available_tools" | awk '{$1=$1; print}' | tr ' ' '\n')
- if [ -z "$available_tools" ]; then
- printf "No browser found\n" >&2
- exit 1
- fi
-
- opentool=$(printf "%s\n" "$available_tools" | dmenu -i -p "Choose an open tool:")
-
- # Set the selected tool to the variable 'open'
- case "$opentool" in
- xdg-open) xdg-open "$1" ;;
- open)
- case "$(uname -s)" in
- Darwin) open "$1" ;;
- *) xdg-open "$1" ;;
- esac
- ;;
- lynx) setsid -f "$TERMINAL" -e lynx "$1" ;;
- w3m) setsid -f "$TERMINAL" -e w3m "$1" ;;
- *) echo "Invalid selection" >&2 && exit 1 ;;
- esac
-}
-
-openwindow() {
- if [ "$1" = "private" ]; then
- case "$BROWSER" in
- *qutebrowser*) "$BROWSER" --target private-window "$url" ;;
- *firefox* | *librewolf*) "$BROWSER" --private-window "$url" ;;
- esac
- else
- case "$BROWSER" in
- *qutebrowser*) "$BROWSER" --target window "$url" ;;
- *firefox* | *librewolf*) "$BROWSER" --new-window "$url" ;;
- esac
- fi
-}
-
-openinbrowser() {
- # Extract only the default part of the profile name
- case $BROWSER in
- *firefox*)
- profiles_ini_path="$HOME/.mozilla/firefox/profiles.ini"
- profile=$(awk '/\[Install/ {found=1} found && /^Default=/ {split($0, arr, "."); print arr[2]; exit}' "$profiles_ini_path")
- profile_dir=$(find ~/.mozilla/firefox -type d -name "*.$profile*" | head -n 1)
- db_path="$profile_dir/places.sqlite"
- ;;
- *librewolf*)
- profiles_ini_path="$HOME/.librewolf/profiles.ini"
- profile=$(awk '/\[Install/ {found=1} found && /^Default=/ {split($0, arr, "."); print arr[2]; exit}' "$profiles_ini_path")
- profile_dir=$(find ~/.librewolf -type d -name "*.$profile*" | head -n 1)
- db_path="$profile_dir/places.sqlite"
- ;;
- *qutebrowser*)
- profile_dir="${XDG_DATA_HOME:-${HOME}/.local/share}/qutebrowser"
- db_path="$profile_dir/history.sqlite"
- ;;
- *) echo "Default browser path is needed." && exit ;;
- esac
-
- tmp_file="$(mktemp)"
- cp -f "$db_path" "$tmp_file"
-
- type dmenu >/dev/null 2>&1 &&
- selection="dmenu -i -l 20 -p \"Choose a $1 to open:\"" ||
- selection="fzf-tmux --reverse --cycle --ansi --delimiter='|' --with-nth=1..-2"
-
- cols=$((${COLUMNS:-90} / 3))
- case "$1" in
- *bookmark*)
- case "$BROWSER" in
- qutebrowser) bookmarks -o ;;
- *firefox* | *librewolf*)
- sqlite_query="
- SELECT substr(b.title, 1, $cols) || ' | ' || p.url AS bookmark
- FROM moz_bookmarks b
- JOIN moz_places p ON b.fk = p.id
- WHERE b.type = 1 AND p.url LIKE 'http%' AND b.title NOT NULL
- ORDER BY b.title;
- "
- ;;
- *qutebrowser*) geturls && openwindow && exit ;;
- esac
- ;;
- *history*)
- case "$BROWSER" in
- *qutebrowser*)
- sqlite_query="
- SELECT substr(h.title, 1, $cols) || ' | ' || h.url AS bookmark
- FROM CompletionHistory h
- ORDER BY h.last_atime DESC
- LIMIT 100;
- "
- ;;
- *firefox* | *librewolf*)
- sqlite_query="
- SELECT substr(p.title, 1, $cols) || ' | ' || p.url
- FROM moz_places p
- JOIN moz_historyvisits hv ON hv.place_id = p.id
- ORDER BY hv.visit_date DESC
- LIMIT 100;
- "
- ;;
- esac
- ;;
- esac
- choice=$(sqlite3 "$tmp_file" "$sqlite_query" | eval "$selection" | cut -d'|' -f2 | sed 's|.*\(https://\)|\1|' | xargs)
- if [ -n "$choice" ]; then
- if echo "$1" | grep -q "private"; then
- "$BROWSER" --private-window "$choice"
- else
- opentool "$choice"
- fi
- else
- exit
- fi
- rm "$tmp_file"
-}
-
-geturls() {
- urls=$(cat ~/.config/qutebrowser/quickmarks ~/.config/qutebrowser/bookmarks/urls ~/.local/share/thesiah/snippets ~/.local/share/thesiah/urls 2>/dev/null)
- choice=$(echo "$urls" | grep -v -e '^#' -e '^$' | awk '
- {
- if ($1 ~ /^https?:\/\//) { alias = substr($0, index($0, $2)) } # Case 2: URL first
- else { alias = substr($0, 1, length($0) - length($NF) - 1) } # Case 1: URL last
- print alias
- }' | dmenu -i -l 50 -p "Choose an alias $1:")
-
- [ -z "$choice" ] && exit
- url=$(echo "$urls" | grep -v -e '^#' -e '^$' | awk -v choice="$choice" '
- {
- if ($1 ~ /^https?:\/\//) { url = $1; alias = substr($0, index($0, $2)) } # Case 2
- else { alias = substr($0, 1, length($0) - length($NF) - 1); url = $NF } # Case 1
- if (alias == choice) print url
- }')
-}
-
-copytoclipboard() {
- if command -v xclip >/dev/null 2>&1; then
- printf "%s" "$url" | xclip -selection clipboard
- elif command -v clipcopy >/dev/null 2>&1; then
- printf "%s" "$url" | clipcopy
- elif command -v xsel >/dev/null 2>&1; then
- printf "%s" "$url" | xsel --clipboard --input
- else
- echo "Clipboard utility not found. Install xclip, clipcopy, or xsel." >&2
- exit 1
- fi
- notify-send "'$choice' copied in clipbaord" "$url"
-}
-
-[ $# -eq 0 ] && usage && exit 1
-
-while getopts "abchopstv" opt; do
- case $opt in
- a) addurls ;;
- b) openinbrowser "bookmark" ;;
- c) geturls "to copy" && copytoclipboard ;;
- o) geturls "to open in $BROWSER" && openwindow ;;
- p) geturls "to open in private $BROWSER" && openwindow private ;;
- s) openinbrowser "history" ;;
- t) geturls "to type under cursor" && xdotool type "$url" ;;
- v) openinbrowser "private bookmark" ;;
- h | *) usage && exit 0 ;;
- esac
-done
diff --git a/fedora/.local/bin/lastnvim b/fedora/.local/bin/lastnvim
deleted file mode 100755
index b1ab6c9..0000000
--- a/fedora/.local/bin/lastnvim
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-
-# Display help message
-usage() {
- echo "Open the most recent file or the list of old files in fzf edited by nvim."
- echo ""
- echo "Usage: ${0##*/} [OPTION]"
- echo ""
- echo "Options:"
- echo " : Open the most recent old file in Neovim."
- echo " -h, --help : Show this help message."
- echo " -l, --list : Show all recent files in Neovim 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
-}
-
-# List and handle oldfiles
-list_oldfiles() {
- # Fetch the oldfiles list from Neovim
- oldfiles=$(nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa)
-
- # Exit if no oldfiles are found
- [ -z "$oldfiles" ] && {
- echo "No recent files found in Neovim." >&2
- exit 1
- }
-
- case "$1" in
- -h | --help)
- usage
- ;;
- -l | --list)
- # Filter valid files
- valid_files=$(echo "$oldfiles" | while IFS= read -r file; do
- [ -f "$file" ] && printf "%s\n" "$file"
- done)
-
- # Exit if no valid files exist
- [ -z "$valid_files" ] && {
- echo "No valid files found." >&2
- exit 1
- }
-
- # Use fzf to select files
- 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)
-
- # Exit if no files were selected
- [ -z "$selected_files" ] && exit 1
-
- # Open selected files in Neovim
- openfiles "$selected_files"
- ;;
- *)
- # 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/lastvim b/fedora/.local/bin/lastvim
new file mode 100755
index 0000000..435dfba
--- /dev/null
+++ b/fedora/.local/bin/lastvim
@@ -0,0 +1,115 @@
+#!/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/openfiles b/fedora/.local/bin/openfiles
index 5b4f7e2..f35aef1 100755
--- a/fedora/.local/bin/openfiles
+++ b/fedora/.local/bin/openfiles
@@ -1,7 +1,7 @@
#!/bin/sh
-if ! command -v nvim >/dev/null 2>&1; then
- echo "Error: 'nvim' is not installed." >&2
+if ! command -v vim >/dev/null 2>&1; then
+ echo "Error: 'vim' is not installed." >&2
exit 1
fi
@@ -20,15 +20,15 @@ count=$#
case "$count" in
2)
- ${EDITOR:-nvim} -O +'silent! normal g;' "$@" -c 'wincmd t'
+ ${EDITOR:-vim} -O +'silent! normal g;' "$@" -c 'wincmd t'
;;
3)
- ${EDITOR:-nvim} -O "$1" -c 'wincmd j' -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd t'
+ ${EDITOR:-vim} -O "$1" -c 'wincmd j' -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd t'
;;
4)
- ${EDITOR:-nvim} -O "$1" -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd h' -c "silent! split $4" -c 'wincmd t'
+ ${EDITOR:-vim} -O "$1" -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd h' -c "silent! split $4" -c 'wincmd t'
;;
*)
- ${EDITOR:-nvim} "$@"
+ ${EDITOR:-vim} "$@"
;;
esac
diff --git a/fedora/.local/bin/restartnvim b/fedora/.local/bin/restartvim
index ab040ab..3c63f8b 100755
--- a/fedora/.local/bin/restartnvim
+++ b/fedora/.local/bin/restartvim
@@ -15,11 +15,11 @@ fi
# Get the current tmux pane ID
tmux_pane=$(tmux display-message -p '#D')
-# Send Escape, :wq, and Enter to Neovim in the tmux pane
+# Send Escape, :wq, and Enter to Vim in the tmux pane
tmux send-keys -t "$tmux_pane" Escape C-m ':wq' C-m
-# Wait to ensure Neovim exits
+# Wait to ensure Vim exits
sleep 0.5
-# Detach the script from Neovim and wait a bit to ensure Neovim exits
-(nohup sh -c "sleep 0.5; tmux send-keys -t \"$tmux_pane\" 'nvim -c \"execute \\\"edit \\\" . v:oldfiles[0] | normal '\''0\"' C-m" >/dev/null 2>&1 &)
+# Detach the script from Vim and wait a bit to ensure Vim exits
+(nohup sh -c "sleep 0.5; tmux send-keys -t \"$tmux_pane\" 'vim -c \"execute \\\"edit \\\" . v:oldfiles[0] | normal '\''0\"' C-m" >/dev/null 2>&1 &)
diff --git a/fedora/.local/bin/rgafiles b/fedora/.local/bin/rgafiles
index e8b5e72..ac4471b 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 nvim"
+ echo " ${0##*/} 'KEYWORD' # Open files containing 'KEYWORD' in vim"
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 nvim
+ # Otherwise, open the files with vim
set -- "$(printf "%s\n" "$rga_output")"
openfiles "$@"
fi
diff --git a/fedora/.local/bin/tmuxopen b/fedora/.local/bin/tmuxopen
index 5362215..87e4f36 100755
--- a/fedora/.local/bin/tmuxopen
+++ b/fedora/.local/bin/tmuxopen
@@ -16,7 +16,7 @@ wrapper() {
echo " Ctrl+d Search directories"
echo ""
echo "Environment Variables:"
- echo " NVIM_SEARCH_REGISTRY Set to the search query, allowing Neovim to highlight matches"
+ echo " VIM_SEARCH_REGISTRY Set to the search query, allowing Neovim to highlight matches"
echo ""
echo "Example:"
echo " tmuxopen # Run the normal search and open"
@@ -79,32 +79,32 @@ wrapper() {
--prompt "🔎 "
}
- set_nvim_search_variable() {
+ set_vim_search_variable() {
raw_output="$1"
tmp_content_query="/tmp/search-content-query-$$"
if [ -f "$tmp_content_query" ]; then
saved_query=$(cat "$tmp_content_query" 2>/dev/null)
if [ -n "$saved_query" ]; then
- export NVIM_SEARCH_REGISTRY="$saved_query"
+ export VIM_SEARCH_REGISTRY="$saved_query"
return
fi
fi
query=$(echo "$raw_output" | head -n1)
- export NVIM_SEARCH_REGISTRY="$query"
+ export VIM_SEARCH_REGISTRY="$query"
}
- open_files_in_nvim() {
+ open_files_in_vim() {
pane="$1"
shift
file_indices="$*"
- nvim_cmd="nvim"
+ vim_cmd="vim"
for index in $file_indices; do
file=$(echo "$files" | awk -v idx="$index" '{print $idx}')
line=$(echo "$lines" | awk -v idx="$index" '{print $idx}')
- nvim_cmd="$nvim_cmd +$line $file"
+ vim_cmd="$vim_cmd +$line $file"
done
- nvim_cmd="$nvim_cmd -c 'let @/=\"$NVIM_SEARCH_REGISTRY\"'"
- tmux send-keys -t "$pane" "$nvim_cmd" C-m
+ vim_cmd="$vim_cmd -c 'let @/=\"$VIM_SEARCH_REGISTRY\"'"
+ tmux send-keys -t "$pane" "$vim_cmd" C-m
}
# Parse command line arguments
@@ -123,7 +123,7 @@ wrapper() {
done
raw_output=$(get_fzf_output)
- set_nvim_search_variable "$raw_output"
+ set_vim_search_variable "$raw_output"
# Split the newline-delimited output into an array, skipping the first line (query)
selections=$(echo "$raw_output" | sed 1d)
@@ -158,42 +158,42 @@ EOF
fi
if [ "$count" -eq 1 ]; then
- open_files_in_nvim "$(tmux display-message -p '#P')" 1
+ open_files_in_vim "$(tmux display-message -p '#P')" 1
else
window_name="$(date +%s)"
tmux new-window -n "$window_name"
case "$count" in
2)
tmux split-window -t "$window_name" -h -p 50
- open_files_in_nvim "$window_name.1" 1
- open_files_in_nvim "$window_name.2" 2
+ open_files_in_vim "$window_name.1" 1
+ open_files_in_vim "$window_name.2" 2
tmux select-pane -t "$window_name.1"
;;
3)
tmux split-window -t "$window_name" -h -p 50
tmux split-window -t "$window_name.2" -v -p 50
- open_files_in_nvim "$window_name.1" 1
- open_files_in_nvim "$window_name.2" 2
- open_files_in_nvim "$window_name.3" 3
+ open_files_in_vim "$window_name.1" 1
+ open_files_in_vim "$window_name.2" 2
+ open_files_in_vim "$window_name.3" 3
;;
*)
tmux split-window -t "$window_name" -h -p 50
tmux split-window -t "$window_name.1" -v -p 50
tmux split-window -t "$window_name.3" -v -p 50
- open_files_in_nvim "$window_name.1" 1
- open_files_in_nvim "$window_name.2" 2
- open_files_in_nvim "$window_name.3" 3
+ open_files_in_vim "$window_name.1" 1
+ open_files_in_vim "$window_name.2" 2
+ open_files_in_vim "$window_name.3" 3
remaining_indices=""
for i in $(seq 4 "$count"); do
remaining_indices="$remaining_indices $i"
done
- open_files_in_nvim "$window_name.4" "$remaining_indices"
+ open_files_in_vim "$window_name.4" "$remaining_indices"
;;
esac
fi
}
-for cmd in rg fzf bat tmux nvim; do
+for cmd in rg fzf bat tmux vim; do
if ! command -v $cmd >/dev/null 2>&1; then
echo "Error: $cmd not found" >&2
exit 1