This commit is contained in:
DeveloperDurp 2025-04-06 10:08:57 -05:00
parent 0b1975d9a9
commit f4acd05a20
6 changed files with 97 additions and 35 deletions

View file

@ -1 +1 @@
"display"
"panel"

View file

@ -2,6 +2,9 @@ return {
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
position = "float",
},
filesystem = {
filtered_items = {
hide_dotfiles = false,

View file

@ -2,7 +2,7 @@
dir=${1:-}
[ -z "${dir}" ] && dir=$(find $HOME/Documents/gitlab -mindepth 2 -maxdepth 2 -type d | awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --with-nth=1 | awk '{print $2}')
[ -z "${dir}" ] && dir=$(find $HOME/Documents/gitlab -mindepth 2 -maxdepth 2 -type d | awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --reverse --header "New Session" --with-nth=1 | awk '{print $2}')
[ -z "$dir" ] && return 1
name=$(basename "$dir")
@ -23,7 +23,7 @@ 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-m
tmux send-keys -t "$name:1.1" 'set-env; nvim' C-m
sleep 0.1
tmux send-keys -t "$name:1.3" 'set-env; nvim +CodeCompanionChat -c only' C-m
sleep 1

View file

@ -0,0 +1,60 @@
#!/bin/bash
action=${1:-}
[ -z "$action" ] && echo "Please enter an action" && return 1
if [[ $action == "new" ]]; then
dir=$(find $HOME/Documents/gitlab -mindepth 2 -maxdepth 2 -type d | awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --no-preview --reverse --header "New Session" --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"
tmux rename-window -t "$name" "nvim"
tmux new-window -t "$name" -n terminal -c "$dir"
sleep 1
tmux send-keys -t "$name:1" 'set-env; nvim' C-m
tmux select-window -t "$name:1"
tmux switch-client -t "$name"
fi
if [[ $action == "switch" ]]; then
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |
sed '/^popup/d' |
sed '/^$/d' |
fzf --reverse --header 'Switch Session' --preview 'tmux capture-pane -pt {}' \
--bind 'enter:execute(tmux switch-client -t {})+accept'
fi
if [[ $action == "delete" ]]; then
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |
sed '/^popup/d' |
sed '/^$/d' |
fzf --reverse --header 'Delete Session' --preview 'tmux capture-pane -pt {}' \
--bind 'enter:execute(tmux kill-session -t {})+accept'
fi
if [[ $action == "window" ]]; then
window=$(tmux list-windows -F '#{window_index} #{window_name}' |
sed '/^$/d' |
fzf --reverse --header 'Switch Window' --no-preview |
cut -d ' ' -f 1)
[ -z "$window" ] && return 1
tmux select-window -t $window
fi

View file

@ -1,26 +1,30 @@
# Defualt Shell
set-option -g default-shell /bin/zsh
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
#set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on
# Enable 256-color and true-color (24-bit) support in tmux
set -g default-terminal "screen-256color" # Set terminal type for 256-color support
set -ga terminal-overrides ",*256col*:Tc" # Override to enable true-color for compatible terminals
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
setw -g mode-keys vi
bind -T copy-mode-vi WheelUpPane send -X scroll-up
bind -T copy-mode-vi WheelDownPane send -X scroll-down
#set-option -g aggressive-resize off
bind r source-file ~/.config/tmux/tmux.conf
set -g mouse on
set -g set-clipboard on
set -g @yank_selection_mouse 'clipboard'
set -g @yank_selection 'clipboard'
set -g status-right "#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD) "
set -g status-justify centre
set -g detach-on-destroy off
set -g status-interval 3
set -g allow-passthrough on
#Change Tmux keybindings
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
set -g allow-passthrough on
#set -g default-terminal "screen-256color"
#set -ga update-environment TERM
#set -ga update-environment TERM_PROGRAM
# Vim style pane selection
bind h select-pane -L
@ -33,11 +37,14 @@ set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
set-option -g @ssh-split-h-key "%"
set-option -g @ssh-split-v-key '"'
set-option -g @ssh-split-h-key "h"
set-option -g @ssh-split-v-key 'v'
set-option -g @ssh-split-keep-cwd "true"
set-option -g @ssh-split-keep-remote-cwd "true"
# Resource Config
bind r source-file ~/.config/tmux/tmux.conf
# resize windows
bind -n C-M-h resize-pane -L 5
bind -n C-M-l resize-pane -R 5
@ -52,6 +59,7 @@ bind -n S-Right next-window
bind -n M-H previous-window
bind -n M-L next-window
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
@ -59,9 +67,12 @@ set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'pschmitt/tmux-ssh-split'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @catppuccin_flavor 'mocha'
# Resurrect
set -g @resurrect-capture-pane-contents 'on'
# set vi-mode
set-window-option -g mode-keys vi
# keybindings
@ -69,30 +80,18 @@ bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel "xsel -i --clipboard"
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
#bind '"' split-window -v -c "#{pane_current_path}"
#bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind C-n display-popup -E -w 80% -h 75% ". $HOME/.config/scripts/new-session.sh"
bind C-N display-popup -E -w 80% -h 75% ". $HOME/.config/scripts/new-session.sh"
bind C-s display-popup -E -w 80% -h 75% "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^popup/d' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' \
--bind 'enter:execute(tmux switch-client -t {})+accept'"
bind C-d display-popup -E -w 80% -h 75% "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^popup/d' |\
sed '/^$/d' |\
fzf --reverse --header 'Delete Session' --preview 'tmux capture-pane -pt {}' \
--bind 'enter:execute(tmux kill-session -t {})+accept'"
bind n display-popup -E -w 50% -h 50% ". $HOME/.config/scripts/sessions.sh new"
bind s display-popup -E -w 50% -h 50% ". $HOME/.config/scripts/sessions.sh switch"
bind d display-popup -E -w 50% -h 50% ". $HOME/.config/scripts/sessions.sh delete"
bind w display-popup -E -w 50% -h 50% ". $HOME/.config/scripts/sessions.sh window"
bind g display-popup -E -w 80% -h 75% "lazygit"
bind k display-popup -E -w 80% -h 75% "k9s"
bind C-f display-popup -E -w 80% -h 75% "yazi"
bind f display-popup -E -w 80% -h 75% "yazi"
bind t if-shell -F '#{==:#{session_name},popup}' {
detach-client