From 89d37946cfdbfb01cce0147cd9801057a9862423 Mon Sep 17 00:00:00 2001 From: Andrew Haynes Date: Thu, 5 Nov 2026 14:15:22 -0500 Subject: [PATCH] chore(starship, nvim, tmux): removing starship, navigation between tmux and nvim, updated environment configs and scripts --- .gitmodules | 3 - brew/.Brewfile | 44 ++-- ghostty/.config/ghostty/config | 3 +- macutil.sh | 21 +- .../nvim/lua/DarthMooMancer/keymaps.lua | 90 +++---- nvim/.config/nvim/lua/DarthMooMancer/lsp.lua | 47 +--- nvim/.config/nvim/lua/DarthMooMancer/opts.lua | 2 +- .../nvim/lua/DarthMooMancer/plugins.lua | 16 +- .../nvim/lua/DarthMooMancer/plugins/mason.lua | 1 + .../lua/DarthMooMancer/plugins/treesitter.lua | 1 - nvim/.config/nvim/nvim-pack-lock.json | 20 +- ssh/.ssh/config | 1 - starship/.config/starship.toml | 9 - tmux/.config/tmux/plugins/tpm | 1 - tmux/.config/tmux/plugins/vim-tmux-navigator | 1 - tmux/.config/tmux/tmux.conf | 33 +-- tmux/.local/bin/tmux-sessionizer | 232 +++++------------- tmux/.local/bin/tmux-sessionizer-bak_2 | 188 ++++++++++++++ zshrc/.zshrc | 46 ++-- 19 files changed, 354 insertions(+), 405 deletions(-) delete mode 100644 .gitmodules delete mode 100644 starship/.config/starship.toml delete mode 160000 tmux/.config/tmux/plugins/tpm delete mode 160000 tmux/.config/tmux/plugins/vim-tmux-navigator create mode 100755 tmux/.local/bin/tmux-sessionizer-bak_2 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8b60c27..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "tmux/.config/tmux/plugins/tpm"] - path = tmux/.config/tmux/plugins/tpm - url = https://github.com/tmux-plugins/tpm diff --git a/brew/.Brewfile b/brew/.Brewfile index 2027b89..27fe9cc 100644 --- a/brew/.Brewfile +++ b/brew/.Brewfile @@ -1,36 +1,34 @@ +# Tools cask "ghostty" -cask "font-jetbrains-mono-nerd-font" cask "google-chrome" cask "tailscale-app" -cask "colemak-dh" -brew "mole" -brew "ripgrep" brew "neovim" -brew "tree-sitter" # dep to neovim -brew "tree-sitter-cli" # dep to neovim -brew "eza" -brew "starship" +brew "mole" brew "tmux" +brew "fzf" +brew "zoxide" +brew "opencode" + +# Utilities +brew "ripgrep" +brew "eza" brew "bat" +brew "fd" +brew "git" +brew "stow" +brew "jq" +# brew "jpeg-turbo" # Used in libimg processor / C +# brew "pkgconfig" # Used in libimg processor / C + +# Ricing +cask "font-jetbrains-mono-nerd-font" + +# Languages & Runtimes brew "python" brew "cmake" -brew "fd" -brew "fzf" -brew "git" -brew "zoxide" -brew "stow" -brew "jpeg-turbo" -brew "pkgconfig" -brew "npm" +brew "node" brew "go" -brew "wget" -brew "jq" -brew "ruby" -brew "opencode" brew "uv" brew "lua" -brew "luarocks" -brew "openjdk" brew "bun" -brew "kanata" diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config index 2730012..0de55d6 100644 --- a/ghostty/.config/ghostty/config +++ b/ghostty/.config/ghostty/config @@ -1,4 +1,5 @@ -theme = "/Users/andrew/.config/ghostty/themes/kanso-zen" +# theme = "/Users/andrew/.config/ghostty/themes/kanso-zen" +theme = kanso-zen # theme = dark:Rose Pine,light:Rose Pine Dawn font-family = "JetBrainsMono Nerd Font Medium" font-thicken = true diff --git a/macutil.sh b/macutil.sh index 2c5c7a5..80e6b5e 100755 --- a/macutil.sh +++ b/macutil.sh @@ -1,6 +1,7 @@ +#!/usr/bin/env bask sudo -v while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & -#/usr/bin/env bash + if ! command -v brew &> /dev/null; then echo "Installing Homebrew..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" @@ -17,29 +18,19 @@ fi # echo "Installing Cargo" # curl https://sh.rustup.rs -sSf | sh # fi -if ! command -v zinit &> /dev/null; then - echo "Installing zinit" - bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" -fi DOTFILES_DIR="$HOME/dotfiles" if [ ! -d "$DOTFILES_DIR" ]; then echo "Cloning dotfiles..." -git clone https://git@moo:dmm/dotfiles.git +git clone https://git.moomancer.xyz/DarthMooMancer/dotfiles.git fi cd "$DOTFILES_DIR" -brew bundle --file=.Brewfile +brew bundle --file=brew/.Brewfile -stow . +stow -v -t "$HOME" cd ~/ -TPM_DIR="$HOME/.config/tmux/plugins/tpm/" -if [ ! -d "$TPM_DIR" ]; then - echo "Cloning tpm..." - git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm -fi - - +# # Enable Touch ID for sudo if ! grep -q "pam_tid.so" /etc/pam.d/sudo; then echo "Enabling Touch ID for sudo..." diff --git a/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua index 0a9195b..ad0d057 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua @@ -20,6 +20,11 @@ map('n', '', 'j', { silent = true }) map('n', '', 'k', { silent = true }) map('n', '', 'l', { silent = true }) +map('n', '', ':NvimTmuxNavigateLeft', { silent = true }) +map('n', '', ':NvimTmuxNavigateDown', { silent = true }) +map('n', '', ':NvimTmuxNavigateUp', { silent = true }) +map('n', '', ':NvimTmuxNavigateRight', { silent = true }) + map('n', 'E', ':Ex') map('n', 'lp', 'LivePreview pick') @@ -33,9 +38,7 @@ map('n', 'uu', function() }) end, { desc = 'native undotree', silent = true }) -map('n', 'ff', function() - require('conform').format({ async = true, lsp_format = 'never' }) -end) +map('n', 'ff', vim.lsp.buf.format) map('n', 'fs', vim.lsp.buf.document_symbol) map('n', 'gd', vim.lsp.buf.definition) @@ -43,61 +46,40 @@ map('n', 'gr', vim.lsp.buf.references) map('n', 'gR', vim.lsp.buf.rename) map('n', 'gc', vim.lsp.buf.code_action) -map('n', 'xx', function() - local qf_open = false - for _, win in ipairs(vim.fn.getwininfo()) do - if win.quickfix == 1 then - qf_open = true - break - end - end - if qf_open then - vim.cmd('cclose') - else - vim.diagnostic.setqflist() - if #vim.fn.getqflist() == 0 then - vim.notify('No diagnostics found', vim.log.levels.WARN) - else - vim.cmd('copen') - end - end -end, { desc = 'Toggle Diagnostics Quickfix' }) +local function qf_is_open() + return vim.fn.getqflist({ winid = 0 }).winid ~= 0 +end -local qf_group = vim.api.nvim_create_augroup('QuickFixDiagnostics', { clear = true }) +local function diagnostic_items() + return vim.diagnostic.toqflist(vim.diagnostic.get()) +end + +map('n', 'xx', function() + if qf_is_open() then + vim.cmd('cclose') + return + end + local items = diagnostic_items() + if #items == 0 then + vim.notify('No diagnostics found', vim.log.levels.WARN) + return + end + vim.fn.setqflist(items) + vim.cmd('copen') +end, { desc = 'Toggle diagnostics quickfix' }) + +local qf_group = vim.api.nvim_create_augroup('DiagnosticsQuickfix', { clear = true }) vim.api.nvim_create_autocmd('DiagnosticChanged', { group = qf_group, callback = function() - vim.schedule(function() - local qf_open = false - for _, win in ipairs(vim.fn.getwininfo()) do - if win.quickfix == 1 then - qf_open = true - break - end - end - if qf_open then - local diagnostics = vim.diagnostic.get() - local qf_items = vim.diagnostic.toqflist(diagnostics) - vim.fn.setqflist(qf_items, 'r') - - if #qf_items == 0 then - vim.cmd('cclose') - vim.notify('No diagnostics found', vim.log.levels.WARN) - end - end - end) - end, -}) - -vim.api.nvim_create_autocmd('FileType', { - group = qf_group, - pattern = 'qf', - callback = function() - vim.schedule(function() - if vim.fn.getqflist({ size = 0 }).size == 0 then - vim.cmd('cclose') - end - end) + if not qf_is_open() then + return + end + local items = diagnostic_items() + vim.fn.setqflist(items, 'r') + if #items == 0 then + vim.cmd('cclose') + end end, }) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua b/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua index 49c07d8..0d824f7 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua @@ -86,52 +86,6 @@ vim.lsp.config('rust_analyzer', { }, }, }) --- vim.lsp.config('gopls', {}) -vim.lsp.config('gopls', { - cmd = { 'gopls' }, - filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, - settings = { - gopls = { - -- Verbose/Enhanced Completion Settings - usePlaceholders = true, -- Enables snippet placeholders (e.g. $1, $2) for function params - completeUnimported = true, -- Auto-suggests and imports packages that aren't yet in your imports block - completeFunctionCalls = false, -- Automatically appends parentheses to function completions - experimentalPostfixCompletions = true, -- Enables postfix completions like slice.sort! - - -- Nice LSP & Diagnostics Settings - analyses = { - unusedparams = true, -- Highlights unused parameters - unusedvariable = true, -- Highlights unused variables - unusedwrite = true, -- Highlights field writes that are never read - shadow = true, -- Catches shadowed variables - fillreturns = true, -- Suggests return values to fill stub functions - nonewdecl = true, -- Catches redeclaration errors early - }, - staticcheck = true, -- Enables staticcheck advanced analyzers for better linting - semanticTokens = true, -- Enables fine-grained semantic syntax highlighting if your theme supports it - codelenses = { - gc_details = true, -- Shows escape analysis details as code lenses - generate = true, -- Adds a code lens to run `go generate` - test = true, -- Adds a code lens to run tests inline - tidy = true, -- Adds a code lens to run `go mod tidy` - upgrade_dependency = true, -- Adds a code lens to upgrade dependencies - vendor = true, -- Adds a code lens to run `go mod vendor` - }, - hints = { - assignVariableTypes = true, -- Inlay hints for variable types - compositeLiteralFields = true, -- Inlay hints for struct literal fields - compositeLiteralTypes = true, -- Inlay hints for struct literal types - constantValues = true, -- Inlay hints for constants - functionTypeParameters = true, -- Inlay hints for generic type parameters - parameterNames = true, -- Inlay hints for function parameter names (e.g. foo(ctx, /* paramName: */ val)) - rangeVariableTypes = true, -- Inlay hints for range loops - }, - }, - }, -}) - --- Enable the server so it attaches to your Go files automatically -vim.lsp.enable('gopls') vim.lsp.enable({ 'lua_ls', @@ -139,6 +93,7 @@ vim.lsp.enable({ 'pylsp', 'rust_analyzer', 'gopls', + --- Web 'vtsls', 'superhtml', diff --git a/nvim/.config/nvim/lua/DarthMooMancer/opts.lua b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua index 9ca48d1..ad5aa33 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/opts.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua @@ -17,6 +17,7 @@ vim.opt.smoothscroll = true vim.opt.updatetime = 50 vim.opt.smartindent = true +vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" local shifts = { lua = 4, @@ -42,6 +43,5 @@ vim.api.nvim_create_autocmd('FileType', { vim.diagnostic.config({ virtual_text = true, - -- virtual_lines = true, severity_sort = true, }) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua index 68dc6ed..e06570a 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua @@ -8,21 +8,15 @@ vim.pack.add({ { src = 'https://github.com/stevearc/conform.nvim' }, { src = 'https://git.moomancer.xyz/DarthMooMancer/mason-conform.nvim.git' }, { src = 'https://github.com/brianhuster/live-preview.nvim' }, - -- { src = 'https://git.moomancer.xyz/DarthMooMancer/vern-nvim' }, - -- { src = 'https://github.com/vague-theme/vague.nvim' }, - -- { src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' }, + { src = 'https://github.com/alexghergh/nvim-tmux-navigation' }, }) - --- require('rose-pine').setup({ --- disable_background = true, --- styles = { --- italic = false, --- }, --- }) - vim.opt.rtp:append('/Users/andrew/personal/Projects/Lua/vern-nvim') vim.cmd('packadd nvim.undotree') +require('nvim-tmux-navigation').setup({ + disable_when_zoomed = true, -- defaults to false +}) + require('DarthMooMancer.plugins.blink-cmp') require('DarthMooMancer.plugins.mini-nvim') require('DarthMooMancer.plugins.vern') diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins/mason.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins/mason.lua index bf7fea6..6025c97 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins/mason.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins/mason.lua @@ -6,6 +6,7 @@ require('mason-lspconfig').setup({ 'pylsp', 'cssls', 'superhtml', + 'gopls', }, automatic_enable = false, }) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins/treesitter.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins/treesitter.lua index d6d0e2e..ad549ae 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins/treesitter.lua @@ -9,7 +9,6 @@ local parsers = { 'typescript', 'tsx', 'css', - 'html', 'python', 'yaml', } diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json index c08dacb..0a46e9b 100644 --- a/nvim/.config/nvim/nvim-pack-lock.json +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -30,29 +30,17 @@ "src": "https://github.com/nvim-mini/mini.nvim.git", "version": ">=0.0.0" }, - "neovim": { - "rev": "ff483051a47e27d84bdef47703538df1ed9f4a47", - "src": "https://github.com/rose-pine/neovim" - }, "nvim-lspconfig": { "rev": "adfbb74472f6c231b651b650a89f414c2680fb31", "src": "https://github.com/neovim/nvim-lspconfig" }, + "nvim-tmux-navigation": { + "rev": "4898c98702954439233fdaf764c39636681e2861", + "src": "https://github.com/alexghergh/nvim-tmux-navigation" + }, "nvim-treesitter": { "rev": "0195cd62fa89950f34c0e0d648ea7897ab85d4d3", "src": "https://github.com/nvim-treesitter/nvim-treesitter" - }, - "rose-pine": { - "rev": "ff483051a47e27d84bdef47703538df1ed9f4a47", - "src": "https://github.com/rose-pine/neovim" - }, - "vague.nvim": { - "rev": "73f8aaa866bf3d14dd0b0ab9e48c11794c1cb7ab", - "src": "https://github.com/vague-theme/vague.nvim" - }, - "vern-nvim": { - "rev": "adbd2bc0e929431cbd2b713df67866019fabfccb", - "src": "https://git.moomancer.xyz/DarthMooMancer/vern-nvim" } } } diff --git a/ssh/.ssh/config b/ssh/.ssh/config index 433f0c8..fbe6e82 100644 --- a/ssh/.ssh/config +++ b/ssh/.ssh/config @@ -4,7 +4,6 @@ Host * IdentityFile ~/.ssh/id_ed25519 Host moo - # HostName 192.168.5.16 HostName 100.78.144.113 User git IdentityFile ~/.ssh/id_ed25519 # Path to your private key diff --git a/starship/.config/starship.toml b/starship/.config/starship.toml deleted file mode 100644 index c3c35cb..0000000 --- a/starship/.config/starship.toml +++ /dev/null @@ -1,9 +0,0 @@ -format = """$directory$character""" - -[directory] -style = "blue" - -[character] -success_symbol = "[❯](purple)" -error_symbol = "[❯](red)" -vimcmd_symbol = "[❮](green)" diff --git a/tmux/.config/tmux/plugins/tpm b/tmux/.config/tmux/plugins/tpm deleted file mode 160000 index e261deb..0000000 --- a/tmux/.config/tmux/plugins/tpm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e261deb1b47614eed3400089ce7197dc68acc4eb diff --git a/tmux/.config/tmux/plugins/vim-tmux-navigator b/tmux/.config/tmux/plugins/vim-tmux-navigator deleted file mode 160000 index e41c431..0000000 --- a/tmux/.config/tmux/plugins/vim-tmux-navigator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e41c431a0c7b7388ae7ba341f01a0d217eb3a432 diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index 8bf3f02..d097db7 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -1,46 +1,33 @@ set -g prefix C-Space bind C-Space send-prefix -set -g default-shell $SHELL set -s escape-time 0 set -g focus-events on set -s theme terminal set -g set-clipboard on set -g detach-on-destroy off +set -g status off set -g default-terminal "tmux-256color" -set -ga terminal-features ',xterm-ghostty:RGB' +set -as terminal-overrides ',xterm*:Tc,ghostty:RGB' set -g base-index 1 set -g pane-base-index 1 set -g renumber-windows on -set -g status off -set -g status-position top -set -g status-justify centre -set -g status-style bg=default - -set -g status-left-length 40 -set -g status-left "#{?client_prefix,#[fg=colour234]#[bg=colour6]#[bold] #S #[bg=default]#[nobold],#[fg=color242]#[bg=default]#S }" -set -g status-right "" - -set -g window-status-separator " " -set -g window-status-format "#[fg=color242]#I:#W" -set -g window-status-current-format "#[fg=colour3 bold]#I:#W" - set -g message-style 'fg=colour3 bg=default bold' +bind -r v display-popup -E -w 80% -h 80% "~/.local/bin/tmux-sessionizer" -bind-key h previous-window -bind-key l next-window -bind-key z resize-pane -Z -bind-key b set-option -g status -bind -r v run-shell "tmux neww ~/.local/bin/tmux-sessionizer" bind -n C-S-h resize-pane -L 5 bind -n C-S-j resize-pane -D 5 bind -n C-S-k resize-pane -U 5 bind -n C-S-l resize-pane -R 5 -set -g @plugin 'tmux-plugins/tpm' -# set -g @plugin 'christoomey/vim-tmux-navigator' +is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +([^ ]+/)?g?(view|l?n?vim?x?|fzf)(diff)?$'" -run '$HOME/.config/tmux/plugins/tpm/tpm' +bind -n C-h if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind -n C-j if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind -n C-k if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind -n C-l if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' + +bind I source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded!" diff --git a/tmux/.local/bin/tmux-sessionizer b/tmux/.local/bin/tmux-sessionizer index d588fe7..99236db 100755 --- a/tmux/.local/bin/tmux-sessionizer +++ b/tmux/.local/bin/tmux-sessionizer @@ -1,188 +1,68 @@ #!/usr/bin/env bash +set -uo pipefail -# Ensure Homebrew and standard paths are accessible inside fzf's preview subshell export PATH="/opt/homebrew/bin:/usr/local/bin:$HOME/.local/bin:$PATH" -# Tabs definition -TABS=("All" "Projects" "Dotfiles" "Blank Session") -TOTAL=${#TABS[@]} -ACTIVE_TAB=0 +list_sessions() { + tmux list-sessions -F '#{session_name}' 2>/dev/null | sed 's/^/@/' +} -# Terminal Palette Colors for the Tab Header (Ghostty palette 12 and 8) -CLR_ACTIVE=$(printf '\033[1;38;5;12m') -CLR_INACTIVE=$(printf '\033[38;5;8m') -CLR_RESET=$(printf '\033[0m') +list_dirs() { + fd --type d --min-depth 1 --max-depth 2 . \ + "$HOME/personal/Projects" "$HOME/personal/Projects_Testing" 2>/dev/null + fd --type d --max-depth 1 . "$HOME/dotfiles" 2>/dev/null + fd --type d --hidden --no-ignore --max-depth 3 \ + --full-path '.*/\.config/[^/]+$' "$HOME/dotfiles" 2>/dev/null + fd --type d --max-depth 1 . "$HOME/.config" 2>/dev/null + printf '%s\n' "$HOME" +} -# Dynamic Previewer (Restored exact working structure from your original script) -preview_cmd=' -if [ "{}" = "[Create Blank Session in ~]" ]; then - echo "Will spawn an empty session in ~/" -elif [ -d {} ]; then - if command -v eza >/dev/null 2>&1; then - eza --tree --level=2 --icons --color=always --git-ignore -I "node_modules|build|dist|target|.cache" {} - elif command -v tree >/dev/null 2>&1; then - tree -C -L 2 --gitignore -I "node_modules|build|dist|target|.cache" {} - else - ls -la --color=always {} - fi +preview=' +p={} +case "$p" in + @*) tmux list-windows -t "${p#@}" 2>/dev/null ;; + *) eza --tree --group-directories-first --level=2 --icons --color=always --git-ignore \ + -I "node_modules|build|dist|target|.cache" "$p" 2>/dev/null \ + || ls -la "$p" ;; +esac +' + +out=$( + { list_sessions; list_dirs; } | + awk '!seen[$0]++' | + fzf --ansi --reverse --height=100% --border=rounded \ + --prompt=' ' \ + --header='enter: open ctrl-b: new blank session esc: cancel' \ + --preview="$preview" --preview-window='right:55%:border-left' \ + --color='hl:#7fb4ca,hl+:#7fb4ca,prompt:#7fb4ca,border:#2d3139,header:#5C6066' \ + --expect=ctrl-b +) + +[[ -z $out ]] && exit 0 + +key=$(sed -n '1p' <<<"$out") +selected=$(sed -n '2p' <<<"$out") + +if [[ $key == ctrl-b || -z $selected ]]; then + idx=1 + while tmux has-session -t "=blank-$idx" 2>/dev/null; do ((idx++)); done + session_name="blank-$idx" + tmux new-session -d -s "$session_name" -c "$HOME" +elif [[ $selected == @* ]]; then + session_name=${selected#@} else - tmux list-windows -t {} 2>/dev/null || echo "Session or path: {}" -fi' - -get_projects() { - if command -v fd &>/dev/null; then - [ -d "$HOME/Projects" ] && fd --type d --max-depth 2 . "$HOME/Projects" 2>/dev/null | sed 's:/*$::' - [ -d "$HOME/personal/Projects" ] && fd --type d --min-depth 2 --max-depth 2 . "$HOME/personal/Projects" 2>/dev/null | sed 's:/*$::' - [ -d "$HOME/personal/Projects_Testing" ] && fd --type d --min-depth 2 --max-depth 2 . "$HOME/personal/Projects_Testing" 2>/dev/null | sed 's:/*$::' - else - if [ -d "$HOME/Projects" ]; then - find "$HOME/Projects" -mindepth 1 -maxdepth 2 \ - \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ - -o -type d -print 2>/dev/null | sed 's:/*$::' - fi - if [ -d "$HOME/personal/Projects" ]; then - find "$HOME/personal/Projects" -mindepth 2 -maxdepth 2 \ - \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ - -o -type d -print 2>/dev/null | sed 's:/*$::' - fi - if [ -d "$HOME/personal/Projects_Testing" ]; then - find "$HOME/personal/Projects_Testing" -mindepth 2 -maxdepth 2 \ - \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ - -o -type d -print 2>/dev/null | sed 's:/*$::' - fi - fi -} - -get_dotfiles() { - if command -v fd &>/dev/null; then - # 1. Standard ~/.config/ - [ -d "$HOME/.config" ] && fd --type d --max-depth 1 . "$HOME/.config" 2>/dev/null | sed 's:/*$::' - - # 2. ~/dotfiles direct packages (e.g. ~/dotfiles/nvim, ~/dotfiles/tmux) - # and stow structures (e.g. ~/dotfiles/nvim/.config/nvim or ~/dotfiles/.config/*) - if [ -d "$HOME/dotfiles" ]; then - # Top-level dotfile modules (depth 1) - fd --type d --max-depth 1 . "$HOME/dotfiles" 2>/dev/null | sed 's:/*$::' - - # Unhide and drill down specifically into any .config folders inside dotfiles - fd --type d --hidden --no-ignore --max-depth 4 \ - --full-path '.*/\.config/[^/]+$' "$HOME/dotfiles" 2>/dev/null | sed 's:/*$::' - fi - else - # Fallback using find - if [ -d "$HOME/.config" ]; then - find "$HOME/.config" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:/*$::' - fi - if [ -d "$HOME/dotfiles" ]; then - # Dotfiles packages + nested .config targets up to 4 levels deep - find "$HOME/dotfiles" -mindepth 1 -maxdepth 4 \ - \( -name ".git" -o -name "node_modules" -o -name ".cache" \) -prune \ - -o -type d -print 2>/dev/null | grep -E '(dotfiles/[^/]+$|/\.config/[^/]+$)' | sed 's:/*$::' - fi - fi | sort -u -} - -get_items_for_tab() { - local tab_idx=$1 - case "$tab_idx" in - 1) # Projects only - get_projects - ;; - 2) # Dotfiles only - get_dotfiles - ;; - 3) # Blank Session - echo "[Create Blank Session in ~]" - ;; - *) # All: tmux sessions + projects + dotfiles + top-level home dirs - tmux list-sessions -F "#S" 2>/dev/null - get_projects - get_dotfiles - find "$HOME" -maxdepth 1 -mindepth 1 -type d ! -name "Library" 2>/dev/null | sed 's:/*$::' - ;; - esac -} - -render_header() { - local active=$1 - local out="" - for i in "${!TABS[@]}"; do - local name="${TABS[$i]}" - if [ "$i" -eq "$active" ]; then - out+="${CLR_ACTIVE}[▶ ${name}]${CLR_RESET} " - else - out+="${CLR_INACTIVE} ${name} ${CLR_RESET} " - fi - done - printf "%s\n" "$out" -} - -# --------------------------------------------------------- -# Tab Navigation Loop -# --------------------------------------------------------- -selected="" -while true; do - fzf_output=$( { render_header "$ACTIVE_TAB"; get_items_for_tab "$ACTIVE_TAB" | grep -v '^$'; } | fzf \ - --ansi \ - --header-lines=1 \ - --expect=tab,btab \ - --layout=reverse \ - --border=rounded \ - --margin=15 \ - --padding=0 \ - --height=100% \ - --prompt="󱇗 " \ - --color="bg:#090E13,bg+:#22262D,fg:#c5c9c7,fg+:#ffffff" \ - --color="hl:#7fb4ca,hl+:#7fb4ca,prompt:#7fb4ca,pointer:#22262D" \ - --color="info:#5C6066,spinner:#5C6066,header:#5C6066,border:#2d3139" \ - --color="label:#7fb4ca" \ - --preview="$preview_cmd" \ - --preview-window="right:55%:border-left") - - fzf_status=$? - # Cancelled via Escape or Ctrl-C - [[ $fzf_status -ne 0 && $fzf_status -ne 1 ]] && exit 0 - - key=$(echo "$fzf_output" | head -n 1) - selection=$(echo "$fzf_output" | tail -n +2) - - if [ "$key" = "tab" ]; then - ACTIVE_TAB=$(( (ACTIVE_TAB + 1) % TOTAL )) - elif [ "$key" = "btab" ]; then - ACTIVE_TAB=$(( (ACTIVE_TAB - 1 + TOTAL) % TOTAL )) - else - selected="$selection" - break - fi -done - -[[ -z "$selected" ]] && exit 0 - -# Strip trailing slash if present -selected="${selected%/}" - -# --------------------------------------------------------- -# Handle Session Creation / Switching -# --------------------------------------------------------- -if [[ "$selected" == "[Create Blank Session in ~]" ]]; then - idx=1 - while tmux has-session -t "=blank-$idx" 2>/dev/null; do - ((idx++)) - done - session_name="blank-$idx" - tmux new-session -d -s "$session_name" -c "$HOME" -elif [[ -d "$selected" ]]; then + if [[ $selected == "$HOME" ]]; then + session_name=home + else session_name=$(basename "$selected" | tr '.: ' '_') - if ! tmux has-session -t "=$session_name" 2>/dev/null; then - tmux new-session -d -s "$session_name" -c "$selected" - fi -else - session_name="$selected" + fi + if ! tmux has-session -t "=$session_name" 2>/dev/null; then + tmux new-session -d -s "$session_name" -c "$selected" + fi fi -if [[ -z "$TMUX" ]]; then - exec tmux attach-session -t "$session_name" +if [[ -z ${TMUX:-} ]]; then + exec tmux attach-session -t "$session_name" else - tmux switch-client -t "$session_name" + tmux switch-client -t "$session_name" fi - diff --git a/tmux/.local/bin/tmux-sessionizer-bak_2 b/tmux/.local/bin/tmux-sessionizer-bak_2 new file mode 100755 index 0000000..d588fe7 --- /dev/null +++ b/tmux/.local/bin/tmux-sessionizer-bak_2 @@ -0,0 +1,188 @@ +#!/usr/bin/env bash + +# Ensure Homebrew and standard paths are accessible inside fzf's preview subshell +export PATH="/opt/homebrew/bin:/usr/local/bin:$HOME/.local/bin:$PATH" + +# Tabs definition +TABS=("All" "Projects" "Dotfiles" "Blank Session") +TOTAL=${#TABS[@]} +ACTIVE_TAB=0 + +# Terminal Palette Colors for the Tab Header (Ghostty palette 12 and 8) +CLR_ACTIVE=$(printf '\033[1;38;5;12m') +CLR_INACTIVE=$(printf '\033[38;5;8m') +CLR_RESET=$(printf '\033[0m') + +# Dynamic Previewer (Restored exact working structure from your original script) +preview_cmd=' +if [ "{}" = "[Create Blank Session in ~]" ]; then + echo "Will spawn an empty session in ~/" +elif [ -d {} ]; then + if command -v eza >/dev/null 2>&1; then + eza --tree --level=2 --icons --color=always --git-ignore -I "node_modules|build|dist|target|.cache" {} + elif command -v tree >/dev/null 2>&1; then + tree -C -L 2 --gitignore -I "node_modules|build|dist|target|.cache" {} + else + ls -la --color=always {} + fi +else + tmux list-windows -t {} 2>/dev/null || echo "Session or path: {}" +fi' + +get_projects() { + if command -v fd &>/dev/null; then + [ -d "$HOME/Projects" ] && fd --type d --max-depth 2 . "$HOME/Projects" 2>/dev/null | sed 's:/*$::' + [ -d "$HOME/personal/Projects" ] && fd --type d --min-depth 2 --max-depth 2 . "$HOME/personal/Projects" 2>/dev/null | sed 's:/*$::' + [ -d "$HOME/personal/Projects_Testing" ] && fd --type d --min-depth 2 --max-depth 2 . "$HOME/personal/Projects_Testing" 2>/dev/null | sed 's:/*$::' + else + if [ -d "$HOME/Projects" ]; then + find "$HOME/Projects" -mindepth 1 -maxdepth 2 \ + \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ + -o -type d -print 2>/dev/null | sed 's:/*$::' + fi + if [ -d "$HOME/personal/Projects" ]; then + find "$HOME/personal/Projects" -mindepth 2 -maxdepth 2 \ + \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ + -o -type d -print 2>/dev/null | sed 's:/*$::' + fi + if [ -d "$HOME/personal/Projects_Testing" ]; then + find "$HOME/personal/Projects_Testing" -mindepth 2 -maxdepth 2 \ + \( -name ".git" -o -name "node_modules" -o -name "build" -o -name ".cache" \) -prune \ + -o -type d -print 2>/dev/null | sed 's:/*$::' + fi + fi +} + +get_dotfiles() { + if command -v fd &>/dev/null; then + # 1. Standard ~/.config/ + [ -d "$HOME/.config" ] && fd --type d --max-depth 1 . "$HOME/.config" 2>/dev/null | sed 's:/*$::' + + # 2. ~/dotfiles direct packages (e.g. ~/dotfiles/nvim, ~/dotfiles/tmux) + # and stow structures (e.g. ~/dotfiles/nvim/.config/nvim or ~/dotfiles/.config/*) + if [ -d "$HOME/dotfiles" ]; then + # Top-level dotfile modules (depth 1) + fd --type d --max-depth 1 . "$HOME/dotfiles" 2>/dev/null | sed 's:/*$::' + + # Unhide and drill down specifically into any .config folders inside dotfiles + fd --type d --hidden --no-ignore --max-depth 4 \ + --full-path '.*/\.config/[^/]+$' "$HOME/dotfiles" 2>/dev/null | sed 's:/*$::' + fi + else + # Fallback using find + if [ -d "$HOME/.config" ]; then + find "$HOME/.config" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:/*$::' + fi + if [ -d "$HOME/dotfiles" ]; then + # Dotfiles packages + nested .config targets up to 4 levels deep + find "$HOME/dotfiles" -mindepth 1 -maxdepth 4 \ + \( -name ".git" -o -name "node_modules" -o -name ".cache" \) -prune \ + -o -type d -print 2>/dev/null | grep -E '(dotfiles/[^/]+$|/\.config/[^/]+$)' | sed 's:/*$::' + fi + fi | sort -u +} + +get_items_for_tab() { + local tab_idx=$1 + case "$tab_idx" in + 1) # Projects only + get_projects + ;; + 2) # Dotfiles only + get_dotfiles + ;; + 3) # Blank Session + echo "[Create Blank Session in ~]" + ;; + *) # All: tmux sessions + projects + dotfiles + top-level home dirs + tmux list-sessions -F "#S" 2>/dev/null + get_projects + get_dotfiles + find "$HOME" -maxdepth 1 -mindepth 1 -type d ! -name "Library" 2>/dev/null | sed 's:/*$::' + ;; + esac +} + +render_header() { + local active=$1 + local out="" + for i in "${!TABS[@]}"; do + local name="${TABS[$i]}" + if [ "$i" -eq "$active" ]; then + out+="${CLR_ACTIVE}[▶ ${name}]${CLR_RESET} " + else + out+="${CLR_INACTIVE} ${name} ${CLR_RESET} " + fi + done + printf "%s\n" "$out" +} + +# --------------------------------------------------------- +# Tab Navigation Loop +# --------------------------------------------------------- +selected="" +while true; do + fzf_output=$( { render_header "$ACTIVE_TAB"; get_items_for_tab "$ACTIVE_TAB" | grep -v '^$'; } | fzf \ + --ansi \ + --header-lines=1 \ + --expect=tab,btab \ + --layout=reverse \ + --border=rounded \ + --margin=15 \ + --padding=0 \ + --height=100% \ + --prompt="󱇗 " \ + --color="bg:#090E13,bg+:#22262D,fg:#c5c9c7,fg+:#ffffff" \ + --color="hl:#7fb4ca,hl+:#7fb4ca,prompt:#7fb4ca,pointer:#22262D" \ + --color="info:#5C6066,spinner:#5C6066,header:#5C6066,border:#2d3139" \ + --color="label:#7fb4ca" \ + --preview="$preview_cmd" \ + --preview-window="right:55%:border-left") + + fzf_status=$? + # Cancelled via Escape or Ctrl-C + [[ $fzf_status -ne 0 && $fzf_status -ne 1 ]] && exit 0 + + key=$(echo "$fzf_output" | head -n 1) + selection=$(echo "$fzf_output" | tail -n +2) + + if [ "$key" = "tab" ]; then + ACTIVE_TAB=$(( (ACTIVE_TAB + 1) % TOTAL )) + elif [ "$key" = "btab" ]; then + ACTIVE_TAB=$(( (ACTIVE_TAB - 1 + TOTAL) % TOTAL )) + else + selected="$selection" + break + fi +done + +[[ -z "$selected" ]] && exit 0 + +# Strip trailing slash if present +selected="${selected%/}" + +# --------------------------------------------------------- +# Handle Session Creation / Switching +# --------------------------------------------------------- +if [[ "$selected" == "[Create Blank Session in ~]" ]]; then + idx=1 + while tmux has-session -t "=blank-$idx" 2>/dev/null; do + ((idx++)) + done + session_name="blank-$idx" + tmux new-session -d -s "$session_name" -c "$HOME" +elif [[ -d "$selected" ]]; then + session_name=$(basename "$selected" | tr '.: ' '_') + if ! tmux has-session -t "=$session_name" 2>/dev/null; then + tmux new-session -d -s "$session_name" -c "$selected" + fi +else + session_name="$selected" +fi + +if [[ -z "$TMUX" ]]; then + exec tmux attach-session -t "$session_name" +else + tmux switch-client -t "$session_name" +fi + diff --git a/zshrc/.zshrc b/zshrc/.zshrc index 303788d..f88c4e0 100644 --- a/zshrc/.zshrc +++ b/zshrc/.zshrc @@ -1,46 +1,46 @@ HISTFILE=~/.zsh_history -HISTSIZE=100 -SAVEHIST=200 +HISTSIZE=50000 +SAVEHIST=50000 +setopt INC_APPEND_HISTORY SHARE_HISTORY HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS -source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" +ZPLUGINS=$HOME/.local/share/zsh/plugins +[[ -d $ZPLUGINS/zsh-autosuggestions ]] || + git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions $ZPLUGINS/zsh-autosuggestions +source $ZPLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh -zinit light zsh-users/zsh-autosuggestions -zinit light zdharma-continuum/fast-syntax-highlighting -zinit light junegunn/fzf +[[ -d $ZPLUGINS/fast-syntax-highlighting ]] || + git clone --depth=1 https://github.com/zdharma-continuum/fast-syntax-highlighting $ZPLUGINS/fast-syntax-highlighting +source $ZPLUGINS/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh -eval "$(starship init zsh)" +[[ -d $ZPLUGINS/pure ]] || + git clone --depth=1 https://github.com/sindresorhus/pure.git $ZPLUGINS/pure +fpath+=($ZPLUGINS/pure) + +autoload -U promptinit; promptinit +prompt pure + +source <(fzf --zsh) eval "$(zoxide init --cmd cd zsh)" -autoload -Uz _zinit -(( ${+_comps} )) && _comps[zinit]=_zinit - -export PATH="$HOME/.local/bin:$PATH" - -alias cat="bat" alias v="nvim" -alias ls="eza -a" -# alias brew-update="brew update && brew upgrade && brew bundle --force-cleanup --zap --file=~/.Brewfile" +alias ls="eza --group-directories-first -a" alias brew-update="brew update && brew upgrade && brew bundle --global --zap cleanup --force" -alias cmake-update="sudo rm -rd build && cmake -S . -B build && cmake --build build" +alias cmake-update="rm -rf build && cmake -S . -B build && cmake --build build" alias oasis="ssh oasis" -export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\\[[0-9;]*m//g; s/.\\x08//g\" | bat -p -l man'" +export MANPAGER="sh -c 'col -bx | bat -p -l main'" export HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_ENV_HINTS=1 export HOMEBREW_DISPLAY_INSTALL_TIMES=0 export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=1 export HOMEBREW_NO_EMOJI=1 -# bun completions -[ -s "/Users/andrew/.bun/_bun" ] && source "/Users/andrew/.bun/_bun" +[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun" -# bun -export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" export PATH="/opt/homebrew/opt/ruby/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/go/bin:$PATH" export PATH="$HOME/go/bin/my-bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/ruby/lib" export CPPFLAGS="-I/opt/homebrew/opt/ruby/include" -export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" -export LUA_PATH="./lua/?.lua;./lua/?/init.lua;;"