This commit is contained in:
DeveloperDurp 2025-04-02 06:16:00 -05:00
parent 8524b70fef
commit a91f52ae24
2 changed files with 6 additions and 12 deletions

View file

@ -1,8 +1,11 @@
dir=$(find $HOME/Documents/gitlab -mindepth 1 -maxdepth 1 -type d | awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --with-nth=1 | awk '{print $2}') #!/bin/bash
dir=${1:-}
[ -z "${dir}" ] && dir=$(find $HOME/Documents/gitlab -mindepth 1 -maxdepth 1 -type d | awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --with-nth=1 | awk '{print $2}')
[ -z "$dir" ] && return 1 [ -z "$dir" ] && return 1
name=$(basename "$dir") name=$(basename "$dir")
if [[ $name == .* ]]; then if [[ $name == .* ]]; then
name=${name#.} name=${name#.}
fi fi
@ -12,28 +15,19 @@ tmux has-session -t ${name} >/dev/null && {
return return
} }
tmux new-session -d -s "$name" -c "$dir" tmux new-session -d -s "$name" -c "$dir"
RIGHT_PANE_WIDTH=60 RIGHT_PANE_WIDTH=60
BOTTOM_PANE_WIDTH=15 BOTTOM_PANE_WIDTH=15
tmux split-window -h -t "$name:1" -c "$dir" tmux split-window -h -t "$name:1" -c "$dir"
tmux resize-pane -t "$name:1.2" -x $RIGHT_PANE_WIDTH tmux resize-pane -t "$name:1.2" -x $RIGHT_PANE_WIDTH
tmux split-window -v -t "$name:1.1" -c "$dir" tmux split-window -v -t "$name:1.1" -c "$dir"
tmux resize-pane -t "$name:1.1" -y $(($(tmux display -p '#{window_height}') - $BOTTOM_PANE_WIDTH)) tmux resize-pane -t "$name:1.1" -y $(($(tmux display -p '#{window_height}') - $BOTTOM_PANE_WIDTH))
tmux new-window "$name" -n lazygit -c "$dir" tmux new-window "$name" -n lazygit -c "$dir"
sleep 1 sleep 1
tmux send-keys -t "$name:1.1" 'nvim -c "Neotree filesystem reveal left"' C-m tmux send-keys -t "$name:1.1" 'nvim -c "Neotree filesystem reveal left"' C-m
sleep 0.1 sleep 0.1
tmux send-keys -t "$name:1.3" 'set-env; nvim +CodeCompanionChat -c only' C-m tmux send-keys -t "$name:1.3" 'set-env; nvim +CodeCompanionChat -c only' C-m
sleep 1 sleep 1
tmux send-keys -t "$name:2" 'lg' C-m tmux send-keys -t "$name:2" 'lg' C-m
tmux select-window -t "$name:1" tmux select-window -t "$name:1"
tmux select-pane -t "$name:1.1" tmux select-pane -t "$name:1.1"
tmux switch-client -t "$name" tmux switch-client -t "$name"

View file

@ -73,7 +73,7 @@ bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}"
bind C-n display-popup -E "$HOME/.config/scripts/new-session.sh" bind C-n display-popup -E ". $HOME/.config/scripts/new-session.sh"
bind C-s display-popup -E "\ bind C-s display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\