Update 2025-05-31

Update 2025-05-06

Update 2025-05-09

Update 2025-05-11

Update 2025-05-13

Update 2025-05-18

Update 2025-05-19

Update 2025-05-24

Update 2025-05-27

Update 2025-05-29

Update 2025-05-31
This commit is contained in:
2025-05-01 17:16:25 +03:00
parent d028d0ad38
commit 1d7d0b7c22
54 changed files with 1577 additions and 521 deletions

View File

@@ -1,37 +1,32 @@
#!/bin/bash
if [[ $# -eq 1 ]]; then
selected=$1
selected="$1"
else
selected=$(project-finder ~/repos/ ~/Nextcloud/ ~/Obsidian/ | sk --height 16)
fi
if [[ -z $selected ]]; then
if [[ -z "$selected" ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
# Create new session with nvim in first window, detached
tmux new-session -ds "$selected_name" -c "$selected" "${EDITOR:-vim} ."
# Create second window as plain terminal
tmux new-window -t "$selected_name:" -c "$selected"
# Select the first window (index 0)
tmux select-window -t "$selected_name:1"
# Attach to the session
tmux attach-session -t "$selected_name"
exit 0
fi
# Check if the session exists
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
# Create new session with nvim in first window, detached
tmux new-session -ds "$selected_name" -c "$selected" "${EDITOR:-vim} ."
# Create second window as plain terminal
# Create a new session, detached, with window 0 in the selected directory
tmux new-session -d -s "$selected_name" -c "$selected"
# Create a second window (index 1) in the same directory
tmux new-window -t "$selected_name:" -c "$selected"
# Select the first window (index 0)
tmux select-window -t "$selected_name:1"
fi
tmux switch-client -t "$selected_name"
# Always select window 0
tmux select-window -t "$selected_name:1"
if [[ -z "$TMUX" ]]; then
# Not inside tmux, attach to the session
tmux attach-session -t "$selected_name"
else
# Inside tmux, switch client to the session
tmux switch-client -t "$selected_name"
fi