diff --git a/.config/cosmic/com.system76.CosmicSettings/v1/active-page b/.config/cosmic/com.system76.CosmicSettings/v1/active-page index a8164e7..ca2db26 100644 --- a/.config/cosmic/com.system76.CosmicSettings/v1/active-page +++ b/.config/cosmic/com.system76.CosmicSettings/v1/active-page @@ -1 +1 @@ -"display" \ No newline at end of file +"panel" \ No newline at end of file diff --git a/.config/nvim/lua/plugins/neotree.lua b/.config/nvim/lua/plugins/neotree.lua index 19d1032..cc27134 100644 --- a/.config/nvim/lua/plugins/neotree.lua +++ b/.config/nvim/lua/plugins/neotree.lua @@ -2,6 +2,9 @@ return { { "nvim-neo-tree/neo-tree.nvim", opts = { + window = { + position = "float", + }, filesystem = { filtered_items = { hide_dotfiles = false, diff --git a/.config/scripts/new-session.sh b/.config/scripts/new-session.sh index becd83f..d0da521 100755 --- a/.config/scripts/new-session.sh +++ b/.config/scripts/new-session.sh @@ -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 diff --git a/.config/scripts/sessions.sh b/.config/scripts/sessions.sh new file mode 100644 index 0000000..8ed11bc --- /dev/null +++ b/.config/scripts/sessions.sh @@ -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 diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index bd6953e..7b79ccd 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -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 diff --git a/DesktopAnsible b/DesktopAnsible index b57d0f7..4601c90 160000 --- a/DesktopAnsible +++ b/DesktopAnsible @@ -1 +1 @@ -Subproject commit b57d0f7501cd7947fbb5fed97bedd28844be7359 +Subproject commit 4601c90662419d4437208bc6a3d88503f769f99a