This commit is contained in:
DeveloperDurp 2025-04-02 05:52:16 -05:00
parent f2452ef445
commit dcd5677fb1
3 changed files with 44 additions and 1 deletions

39
.config/scripts/new-session.sh Executable file
View file

@ -0,0 +1,39 @@
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
name=$(basename "$dir")
if [[ $name == .* ]]; then
name=${name#.}
fi
tmux has-session -t ${name} >/dev/null && {
tmux switch-client -t ${name}
return
}
tmux new-session -d -s "$name" -c "$dir"
RIGHT_PANE_WIDTH=60
BOTTOM_PANE_WIDTH=15
tmux split-window -h -t "$name:1" -c "$dir"
tmux resize-pane -t "$name:1.2" -x $RIGHT_PANE_WIDTH
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 new-window "$name" -n lazygit -c "$dir"
sleep 1
tmux send-keys -t "$name:1.1" 'nvim -c "Neotree filesystem reveal left"' C-m
sleep 0.1
tmux send-keys -t "$name:1.3" 'set-env; nvim +CodeCompanionChat -c only' C-m
sleep 1
tmux send-keys -t "$name:2" 'lg' C-m
tmux select-window -t "$name:1"
tmux select-pane -t "$name:1.1"
tmux switch-client -t "$name"

View file

@ -1,6 +1,7 @@
set-cred () set-cred ()
{ {
export BW_SESSION="$(bw unlock $(secret-tool lookup drive bitwarden) --raw)" export BW_SESSION="$(bw unlock $(secret-tool lookup drive bitwarden) --raw)"
bw sync
printf "$(bw get password cli-gitlab)" | secret-tool store --label='Gitlab Token for CLI' 'token' 'GITLAB_TOKEN' printf "$(bw get password cli-gitlab)" | secret-tool store --label='Gitlab Token for CLI' 'token' 'GITLAB_TOKEN'
printf "$(bw get password cli-ollama-token)" | secret-tool store --label='Ollama Token for CLI' 'token' 'OLLAMA_TOKEN' printf "$(bw get password cli-ollama-token)" | secret-tool store --label='Ollama Token for CLI' 'token' 'OLLAMA_TOKEN'
printf "$(bw get password cli-litellm-token)" | secret-tool store --label='LiteLLM Token for CLI' 'token' 'LITELLM_TOKEN' printf "$(bw get password cli-litellm-token)" | secret-tool store --label='LiteLLM Token for CLI' 'token' 'LITELLM_TOKEN'

View file

@ -1,3 +1,4 @@
set-option -g default-shell /bin/zsh
set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g terminal-overrides 'xterm*:smcup@:rmcup@'
#set-option -sa terminal-overrides ",xterm*:Tc" #set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on set -g mouse on
@ -72,12 +73,14 @@ 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-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}}' |\
sed '/^$/d' |\ sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' \ fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' \
--bind 'enter:execute(tmux switch-client -t {})+accept'" --bind 'enter:execute(tmux switch-client -t {})+accept'"
bind C-g display-popup -E "lazygit" bind g display-popup -E "lazygit"
run '~/.tmux/plugins/tpm/tpm' run '~/.tmux/plugins/tpm/tpm'