diff --git a/git/.gitconfig b/git/.gitconfig new file mode 100644 index 0000000..bb508c1 --- /dev/null +++ b/git/.gitconfig @@ -0,0 +1,59 @@ +# ╔══════════════════════════════════════════════════════════════════════════╗ +# ║ GIT CONFIG ║ +# ║ Tema: Catppuccin Mocha ║ +# ╚══════════════════════════════════════════════════════════════════════════╝ + +[user] + # Configure seu nome e email: + # git config --global user.name "Seu Nome" + # git config --global user.email "seu@email.com" + +[init] + defaultBranch = main + +[core] + pager = delta + editor = vim + +[interactive] + diffFilter = delta --color-only + +[delta] + navigate = true + dark = true + side-by-side = true + line-numbers = true + hyperlinks = true + syntax-theme = Catppuccin Mocha + + # Cores Catppuccin Mocha + minus-style = syntax "#3e1f24" + minus-emph-style = syntax "#6e2d35" + plus-style = syntax "#1e3a29" + plus-emph-style = syntax "#2e5a3e" + line-numbers-minus-style = "#f38ba8" + line-numbers-plus-style = "#a6e3a1" + line-numbers-zero-style = "#6c7086" + hunk-header-style = syntax bold + hunk-header-decoration-style = "#89b4fa" box + +[merge] + conflictStyle = zdiff3 + +[diff] + colorMoved = default + +[pull] + rebase = false + +[push] + autoSetupRemote = true + +[alias] + st = status + co = checkout + br = branch + ci = commit + lg = log --oneline --graph --all --decorate --color + last = log -1 HEAD + unstage = reset HEAD -- diff --git a/install.sh b/install.sh index 090783a..5669c11 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,8 @@ # ║ • Alacritty (terminal GPU-accelerated) ║ # ║ • tmux (multiplexador de terminal) ║ # ║ • Vim (editor com plugins) ║ +# ║ • lazygit (TUI para Git) ║ +# ║ • delta (pager para diffs) ║ # ║ • Fonte JetBrains Mono ║ # ║ ║ # ║ Tema: Catppuccin Mocha ║ @@ -82,9 +84,9 @@ print_help() { echo " --dry-run Simula a instalação sem fazer alterações" echo "" echo "O QUE SERÁ INSTALADO:" - echo " • Dependências: tmux, vim, fzf, ripgrep, xclip" + echo " • Dependências: tmux, vim, fzf, ripgrep, xclip, lazygit, delta" echo " • Fonte: JetBrains Mono" - echo " • Configs: Alacritty, tmux, Vim" + echo " • Configs: Alacritty, tmux, Vim, lazygit, Git" echo " • Tema: Catppuccin Mocha" echo "" echo "ATALHOS PRINCIPAIS:" @@ -273,6 +275,92 @@ install_alacritty() { esac } +# ============================================================================ +# INSTALAÇÃO DO LAZYGIT +# ============================================================================ + +install_lazygit() { + print_step "Instalando lazygit..." + + if command -v lazygit &> /dev/null; then + print_success "lazygit já instalado ($(lazygit --version 2>/dev/null | head -1))" + return 0 + fi + + case $PKG_MANAGER in + apt) + # lazygit não está nos repos padrão, usa o release do GitHub + print_substep "Baixando lazygit do GitHub..." + if [ "$DRY_RUN" = false ]; then + LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') + curl -Lo /tmp/lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" + tar xf /tmp/lazygit.tar.gz -C /tmp lazygit + sudo install /tmp/lazygit /usr/local/bin + rm /tmp/lazygit /tmp/lazygit.tar.gz + fi + print_success "lazygit instalado" + ;; + dnf) + run_cmd sudo dnf copr enable atim/lazygit -y + run_cmd sudo dnf install -y lazygit + print_success "lazygit instalado" + ;; + pacman) + run_cmd sudo pacman -S --noconfirm lazygit + print_success "lazygit instalado" + ;; + brew) + run_cmd brew install lazygit + print_success "lazygit instalado" + ;; + *) + print_warning "Instale lazygit manualmente: https://github.com/jesseduffield/lazygit#installation" + ;; + esac +} + +# ============================================================================ +# INSTALAÇÃO DO DELTA +# ============================================================================ + +install_delta() { + print_step "Instalando delta (pager para diffs)..." + + if command -v delta &> /dev/null; then + print_success "delta já instalado ($(delta --version 2>/dev/null | head -1))" + return 0 + fi + + case $PKG_MANAGER in + apt) + # delta não está nos repos padrão, usa o release do GitHub + print_substep "Baixando delta do GitHub..." + if [ "$DRY_RUN" = false ]; then + DELTA_VERSION=$(curl -s "https://api.github.com/repos/dandavison/delta/releases/latest" | grep -Po '"tag_name": "\K[^"]*') + curl -Lo /tmp/delta.deb "https://github.com/dandavison/delta/releases/latest/download/git-delta_${DELTA_VERSION}_amd64.deb" + sudo dpkg -i /tmp/delta.deb + rm /tmp/delta.deb + fi + print_success "delta instalado" + ;; + dnf) + run_cmd sudo dnf install -y git-delta + print_success "delta instalado" + ;; + pacman) + run_cmd sudo pacman -S --noconfirm git-delta + print_success "delta instalado" + ;; + brew) + run_cmd brew install git-delta + print_success "delta instalado" + ;; + *) + print_warning "Instale delta manualmente: https://github.com/dandavison/delta#installation" + ;; + esac +} + # ============================================================================ # CONFIGURAÇÃO DOS SYMLINKS # ============================================================================ @@ -283,6 +371,7 @@ setup_symlinks() { # Criar diretórios necessários run_cmd mkdir -p ~/.config/alacritty run_cmd mkdir -p ~/.config/tmux + run_cmd mkdir -p ~/.config/lazygit # Função para criar symlink com backup create_symlink() { @@ -313,6 +402,8 @@ setup_symlinks() { create_symlink "$DOTFILES_DIR/alacritty/alacritty.toml" ~/.config/alacritty/alacritty.toml "Alacritty" create_symlink "$DOTFILES_DIR/tmux/.tmux.conf" ~/.tmux.conf "tmux" create_symlink "$DOTFILES_DIR/vim/.vimrc" ~/.vimrc "Vim" + create_symlink "$DOTFILES_DIR/lazygit/config.yml" ~/.config/lazygit/config.yml "lazygit" + create_symlink "$DOTFILES_DIR/git/.gitconfig" ~/.gitconfig "Git" # Scripts do tmux (diretório) if [ -L ~/.config/tmux/scripts ]; then @@ -451,6 +542,18 @@ print_summary() { echo " Espaço+/ Buscar conteúdo" echo " gcc Comentar linha" echo "" + echo " lazygit (TUI para Git):" + echo " lg Abrir lazygit (alias)" + echo " ? Mostrar atalhos" + echo " space Stage/unstage arquivo" + echo " c Commit" + echo " p / P Push / Pull" + echo "" + echo " delta (diffs melhorados):" + echo " Side-by-side Diff lado a lado" + echo " Line numbers Clicáveis (abre no editor)" + echo " Syntax highlight Colorização por linguagem" + echo "" } # ============================================================================ @@ -497,6 +600,8 @@ main() { install_font install_alacritty + install_lazygit + install_delta setup_symlinks setup_vim diff --git a/lazygit/config.yml b/lazygit/config.yml new file mode 100644 index 0000000..9813b87 --- /dev/null +++ b/lazygit/config.yml @@ -0,0 +1,96 @@ +# ╔══════════════════════════════════════════════════════════════════════════╗ +# ║ LAZYGIT CONFIG ║ +# ║ Tema: Catppuccin Mocha ║ +# ╚══════════════════════════════════════════════════════════════════════════╝ + +gui: + # Mostra icones (requer Nerd Font - JetBrains Mono suporta) + nerdFontsVersion: "3" + + # Layout + showFileTree: true + showListFooter: false + showRandomTip: false + showCommandLog: false + showBottomLine: false + + # Comportamento + skipDiscardChangeWarning: false + skipStashWarning: false + + # Tema Catppuccin Mocha + theme: + activeBorderColor: + - "#a6e3a1" # green + - bold + inactiveBorderColor: + - "#a6adc8" # subtext0 + optionsTextColor: + - "#89b4fa" # blue + selectedLineBgColor: + - "#313244" # surface0 + cherryPickedCommitBgColor: + - "#45475a" # surface1 + cherryPickedCommitFgColor: + - "#f5c2e7" # pink + unstagedChangesColor: + - "#f38ba8" # red + defaultFgColor: + - "#cdd6f4" # text + searchingActiveBorderColor: + - "#f9e2af" # yellow + +git: + paging: + colorArg: always + pager: delta --paging=never --line-numbers --hyperlinks --side-by-side --hyperlinks-file-link-format="lazygit-edit://{path}:{line}" + + # Commits + autoFetch: true + autoRefresh: true + branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --" + allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium" + + # Pull/Push + skipHookPrefix: WIP + + # Parsing + parseEmoji: true + +# Confirmacoes +confirmOnQuit: false +quitOnTopLevelReturn: true + +# Keybindings customizados +keybinding: + universal: + quit: "q" + quit-alt1: "" + return: "" + togglePanel: "" + prevItem: "" + nextItem: "" + prevPage: "," + nextPage: "." + scrollLeft: "H" + scrollRight: "L" + gotoTop: "<" + gotoBottom: ">" + prevBlock: "" + nextBlock: "" + nextMatch: "n" + prevMatch: "N" + startSearch: "/" + optionMenu: "x" + edit: "e" + openFile: "o" + scrollUpMain: "" + scrollDownMain: "" + copyToClipboard: "" + refresh: "R" + undo: "z" + redo: "" + +os: + # Abre arquivos no editor padrao + editPreset: "vim" diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 27feb44..8cd1cf1 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -3,14 +3,27 @@ unbind C-b set -g prefix C-a bind C-a send-prefix +# Reduz delay do Escape (padrão 500ms) +set -sg escape-time 10 + +# Alternar para última janela +bind a last-window + # Modo vi para navegação setw -g mode-keys vi +bind Escape copy-mode +bind-key -T copy-mode-vi v send-keys -X begin-selection + +# Clipboard: detecta OS (macOS = pbcopy, Linux/WSL = xclip) +if-shell "uname | grep -q Darwin" \ + "bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'" \ + "bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard'" # Mouse habilitado + copia ao selecionar set -g mouse on if-shell "uname | grep -q Darwin" \ - "bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'" \ - "bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard'" + "bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'" \ + "bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard'" # Histórico maior set -g history-limit 10000 @@ -36,7 +49,23 @@ bind -n M-Down select-pane -D bind r source-file ~/.tmux.conf \; display "Config recarregada!" # Cheatsheet popup -bind h display-popup -E -w 67 -h 42 "~/.config/tmux/scripts/cheatsheet.sh" +bind h display-popup -E -w 112 -h 90% "~/.config/tmux/scripts/cheatsheet.sh" + +# Popup flutuante para comando rápido (efêmero) +bind p display-popup -E -w 80% -h 80% +bind P command-prompt -p "Comando:" "display-popup -E -w 80%% -h 80%% '%%'" + +# Scratch terminal (pode virar pane depois) +bind t if-shell "tmux has-session -t scratch 2>/dev/null" \ + "if-shell \"[ \\\"$(tmux display-message -p '#S')\\\" = scratch ]\" \ + 'detach-client' \ + 'display-popup -E -w 80% -h 80% \"tmux attach -t scratch\"'" \ + "display-popup -E -w 80% -h 80% 'tmux new-session -s scratch'" + +# Mover pane atual para scratch (shift+t) +bind T if-shell "tmux has-session -t scratch 2>/dev/null" \ + "join-pane -t scratch" \ + "new-session -d -s scratch && join-pane -t scratch" # Cores e visual set -g default-terminal "tmux-256color" @@ -53,3 +82,6 @@ set -g window-status-current-format "#[bg=#313244,fg=#cdd6f4,bold] #I:#W " set -g pane-border-style fg="#313244" set -g pane-active-border-style fg="#89b4fa" set -g message-style bg="#313244",fg="#cdd6f4" +bind-key J choose-tree 'join-pane -s %%' +bind-key B break-pane +bind-key S choose-tree 'join-pane -t %%' diff --git a/tmux/scripts/cheatsheet.sh b/tmux/scripts/cheatsheet.sh index 5708b13..469f329 100755 --- a/tmux/scripts/cheatsheet.sh +++ b/tmux/scripts/cheatsheet.sh @@ -1,162 +1,274 @@ #!/bin/bash -show_menu() { - clear +# Catppuccin Mocha colors +RESET='\033[0m' +BOLD='\033[1m' +DIM='\033[2m' + +TEXT='\033[38;2;205;214;244m' +BLUE='\033[38;2;137;180;250m' +LAVENDER='\033[38;2;180;190;254m' +MAUVE='\033[38;2;203;166;247m' +PINK='\033[38;2;245;194;231m' +TEAL='\033[38;2;148;226;213m' +GREEN='\033[38;2;166;227;161m' +YELLOW='\033[38;2;249;226;175m' +PEACH='\033[38;2;250;179;135m' +OVERLAY='\033[38;2;108;112;134m' +SURFACE='\033[38;2;49;50;68m' + +# Clipboard multiplataforma (macOS/Linux/WSL) +copy_to_clipboard() { + if [[ "$(uname)" == "Darwin" ]]; then + pbcopy + elif grep -qi microsoft /proc/version 2>/dev/null; then + clip.exe + else + xclip -selection clipboard 2>/dev/null || xsel --clipboard 2>/dev/null + fi +} + +get_all_shortcuts() { cat << 'EOF' -╭─────────────────────────────────────────────────────────────╮ -│ CHEATSHEET │ -├─────────────────────────────────────────────────────────────┤ -│ │ -│ [1] Alacritty + tmux │ -│ │ -│ [2] Claude CLI │ -│ │ -│ [3] Vim │ -│ │ -│ [q] Fechar │ -│ │ -╰─────────────────────────────────────────────────────────────╯ +[Alacritty] Ctrl+Shift+C Copia texto selecionado para clipboard do sistema +[Alacritty] Ctrl+V Cola conteúdo do clipboard no terminal +[Alacritty] Ctrl++ / Ctrl+- Aumenta ou diminui tamanho da fonte +[Alacritty] Ctrl+0 Volta fonte para tamanho original configurado +[Alacritty] Ctrl+Shift+N Abre nova janela do Alacritty no mesmo diretório +[Alacritty] Ctrl+Shift+Space Ativa Vi mode para navegar histórico com hjkl +[Alacritty] Ctrl+Shift+F Abre busca interativa no output do terminal +[Alacritty] Ctrl+Shift+K Limpa todo histórico de scrollback +[Alacritty] Ctrl+Shift+U Destaca URLs clicáveis no output +[Alacritty] Ctrl+Shift+O Abre arquivo/path sob cursor no VS Code +[Alacritty] Ctrl+Click Abre link sob cursor no navegador padrão +[Tmux] prefix + | Divide painel verticalmente (lado a lado) +[Tmux] prefix + - Divide painel horizontalmente (um sobre outro) +[Tmux] prefix + a Alterna rapidamente entre as duas últimas janelas +[Tmux] prefix + z Maximiza painel atual (toggle zoom) +[Tmux] prefix + c Cria nova janela na sessão atual +[Tmux] prefix + n Vai para próxima janela na lista +[Tmux] Alt + setas Navega entre painéis sem precisar do prefix +[Tmux] prefix + Escape Entra no copy mode para selecionar e copiar texto +[Tmux] v (copy mode) Inicia seleção visual do texto +[Tmux] y (copy mode) Copia seleção para clipboard e sai do copy mode +[Tmux] hjkl (copy mode) Move cursor caractere por caractere +[Tmux] Ctrl+u/d (copy mode) Sobe/desce meia página no histórico +[Tmux] / ou ? (copy mode) Busca texto para frente ou para trás +[Tmux] q (copy mode) Sai do copy mode sem copiar nada +[Tmux] prefix + p Abre shell temporário em popup flutuante +[Tmux] prefix + P Pergunta comando e executa em popup flutuante +[Tmux] prefix + t Abre scratch terminal persistente (pode virar pane) +[Tmux] prefix + h Abre este cheatsheet em popup +[Tmux] prefix + J Traz painel de outra janela para janela atual +[Tmux] prefix + S Envia painel atual para outra janela +[Tmux] prefix + B Transforma painel atual em janela independente +[Tmux] prefix + d Desconecta da sessão (sessão continua rodando) +[Tmux] prefix + r Recarrega arquivo de configuração do tmux +[Claude] claude Inicia nova conversa interativa com Claude +[Claude] claude -c Continua última conversa do diretório atual +[Claude] claude -r Continua conversa mais recente de qualquer lugar +[Claude] claude "prompt" Envia prompt direto e entra em modo interativo +[Claude] claude -p "prompt" Executa prompt e retorna resposta (não interativo) +[Claude] cat file | claude Envia conteúdo de arquivo como contexto +[Claude] /help Mostra ajuda com comandos disponíveis +[Claude] /clear Limpa contexto da conversa atual +[Claude] /compact Compacta histórico para economizar tokens +[Claude] /config Abre menu de configurações do Claude +[Claude] /cost Mostra custo em tokens/dinheiro da sessão +[Claude] /doctor Executa diagnóstico de problemas +[Claude] /quit ou Ctrl+C Encerra sessão atual do Claude +[Vim] leader + w Salva arquivo atual (:w) +[Vim] leader + q Fecha janela/buffer atual (:q) +[Vim] leader + f Abre fuzzy finder para buscar arquivos +[Vim] leader + / Busca texto em todo projeto com ripgrep +[Vim] leader + b Lista buffers abertos para navegação +[Vim] Esc Limpa highlight da última busca +[Vim] gcc Comenta/descomenta linha atual +[Vim] gc{motion} Comenta região (gcap = parágrafo, gcG = até fim) +[Vim] cs'" Troca aspas simples por duplas (surround) +[Vim] ds" Remove aspas ao redor do texto +[Vim] ysiw" Adiciona aspas ao redor da palavra atual +[Vim] Ctrl+o / Ctrl+i Navega posições anteriores/próximas no jumplist +[Vim] gd Vai para definição do símbolo sob cursor +[Vim] * Busca próxima ocorrência da palavra sob cursor +[Vim] % Pula entre parênteses/chaves/colchetes EOF } +show_search() { + local result + result=$(get_all_shortcuts | fzf \ + --ansi \ + --reverse \ + --border=rounded \ + --border-label=" 🔍 Buscar Atalhos " \ + --header="Digite para filtrar • Enter para copiar • Esc para voltar" \ + --prompt="❯ " \ + --pointer="▶" \ + --color="bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8,fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc,marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8,border:#89b4fa,label:#89b4fa" \ + --margin=1 \ + --padding=1) + + if [[ -n "$result" ]]; then + echo "$result" | copy_to_clipboard + fi +} + +show_menu() { + clear + echo -e "${BLUE}${BOLD} ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮${RESET} +${BLUE}${BOLD} │${RESET}${LAVENDER}${BOLD} CHEATSHEET ${RESET}${BLUE}${BOLD}│${RESET} +${BLUE}${BOLD} ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯${RESET} + + ${MAUVE}${BOLD}[1]${RESET} ${TEXT}Alacritty${RESET} ${DIM}─ atalhos do terminal${RESET} ${MAUVE}${BOLD}[3]${RESET} ${TEXT}Claude CLI${RESET} ${DIM}─ comandos e slash commands${RESET} + ${MAUVE}${BOLD}[2]${RESET} ${TEXT}Tmux${RESET} ${DIM}─ painéis, janelas, copy mode${RESET} ${MAUVE}${BOLD}[4]${RESET} ${TEXT}Vim${RESET} ${DIM}─ edição, navegação, plugins${RESET} + +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + + ${YELLOW}${BOLD}[/]${RESET} ${TEXT}Buscar em todos os atalhos${RESET} ${DIM}${OVERLAY}[q] Fechar${RESET} +" +} + show_alacritty() { clear - cat << 'EOF' -╭─────────────────────────────────────────────────────────────╮ -│ [1] ALACRITTY + TMUX │ -├─────────────────────────────────────────────────────────────┤ -│ ALACRITTY │ -│ ───────── │ -│ Ctrl+V Colar │ -│ Ctrl+Shift+C Copiar │ -│ Ctrl++ / Ctrl+- Zoom fonte │ -│ Ctrl+0 Reset zoom │ -│ Ctrl+Shift+F Buscar no output │ -│ Ctrl+Shift+Space Vi mode (navegar com hjkl) │ -│ Ctrl+Shift+K Limpar histórico │ -│ Ctrl+Shift+U Mostrar URLs clicáveis │ -│ Ctrl+Shift+O Abrir path no VS Code │ -│ Ctrl+Shift+N Nova janela │ -│ Ctrl+Click Abrir URL no navegador │ -├─────────────────────────────────────────────────────────────┤ -│ TMUX (prefix = Ctrl+a) │ -│ ───────────────────── │ -│ prefix + | Dividir vertical │ -│ prefix + - Dividir horizontal │ -│ prefix + h Cheatsheet (este popup) │ -│ prefix + r Recarregar config │ -│ prefix + z Zoom no painel atual │ -│ prefix + d Desconectar sessão │ -│ prefix + c Nova janela │ -│ prefix + n/p Próxima/anterior janela │ -│ prefix + [ Modo cópia (q pra sair) │ -│ Alt + setas Navegar painéis │ -╰─────────────────────────────────────────────────────────────╯ - [b] Voltar [q] Fechar -EOF + echo -e "${TEAL}${BOLD} ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮${RESET} +${TEAL}${BOLD} │${RESET}${TEXT}${BOLD} ALACRITTY ${RESET}${TEAL}${BOLD}│${RESET} +${TEAL}${BOLD} ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯${RESET} + +${YELLOW} Clipboard e Janela${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}Ctrl+Shift+C${RESET} ${TEXT}Copia texto selecionado para clipboard do sistema${RESET} + ${GREEN}Ctrl+V${RESET} ${TEXT}Cola conteúdo do clipboard no terminal${RESET} + ${GREEN}Ctrl++ / Ctrl+-${RESET} ${TEXT}Aumenta ou diminui tamanho da fonte${RESET} + ${GREEN}Ctrl+0${RESET} ${TEXT}Volta fonte para tamanho original configurado${RESET} + ${GREEN}Ctrl+Shift+N${RESET} ${TEXT}Abre nova janela do Alacritty no mesmo diretório${RESET} + +${YELLOW} Navegação e Histórico${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}Ctrl+Shift+Space${RESET} ${TEXT}Ativa Vi mode para navegar histórico com hjkl, buscar com /, selecionar com v${RESET} + ${GREEN}Ctrl+Shift+F${RESET} ${TEXT}Abre busca interativa no output do terminal${RESET} + ${GREEN}Ctrl+Shift+K${RESET} ${TEXT}Limpa todo histórico de scrollback${RESET} + +${YELLOW} Integração com Sistema${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}Ctrl+Shift+U${RESET} ${TEXT}Destaca URLs clicáveis no output - navega com Tab, abre com Enter${RESET} + ${GREEN}Ctrl+Shift+O${RESET} ${TEXT}Abre arquivo ou path sob cursor no VS Code${RESET} + ${GREEN}Ctrl+Click${RESET} ${TEXT}Abre link sob cursor diretamente no navegador padrão${RESET} + +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${DIM}${OVERLAY}[b] Voltar [/] Buscar [Esc] Vim mode [q] Fechar${RESET}" +} + +show_tmux() { + clear + echo -e "${MAUVE}${BOLD} ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮${RESET} +${MAUVE}${BOLD} │${RESET}${TEXT}${BOLD} TMUX ${DIM}(prefix = Ctrl+a) ${RESET}${MAUVE}${BOLD}│${RESET} +${MAUVE}${BOLD} ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯${RESET} + +${YELLOW} Janelas e Painéis${RESET} ${YELLOW}Copy Mode ${DIM}(selecionar/copiar texto)${RESET} +${OVERLAY} ───────────────────────────────────────────────── ─────────────────────────────────────────────────${RESET} + ${GREEN}prefix + |${RESET} ${TEXT}Divide vertical (lado a lado)${RESET} ${GREEN}prefix + Esc${RESET} ${TEXT}Entra no copy mode${RESET} + ${GREEN}prefix + -${RESET} ${TEXT}Divide horizontal (um sobre outro)${RESET} ${GREEN}v${RESET} ${TEXT}Inicia seleção visual${RESET} + ${GREEN}prefix + a${RESET} ${TEXT}Alterna entre últimas janelas${RESET} ${GREEN}y${RESET} ${TEXT}Copia seleção pro clipboard${RESET} + ${GREEN}prefix + z${RESET} ${TEXT}Zoom toggle no painel atual${RESET} ${GREEN}hjkl${RESET} ${TEXT}Move cursor${RESET} + ${GREEN}prefix + c${RESET} ${TEXT}Cria nova janela${RESET} ${GREEN}Ctrl+u/d${RESET} ${TEXT}Page up/down${RESET} + ${GREEN}prefix + n${RESET} ${TEXT}Próxima janela${RESET} ${GREEN}/ ou ?${RESET} ${TEXT}Busca frente/trás${RESET} + ${GREEN}Alt+setas${RESET} ${TEXT}Navega painéis sem prefix${RESET} ${GREEN}q${RESET} ${TEXT}Sai do copy mode${RESET} + +${YELLOW} Popups Flutuantes${RESET} ${YELLOW}Reorganizar Painéis${RESET} +${OVERLAY} ───────────────────────────────────────────────── ─────────────────────────────────────────────────${RESET} + ${GREEN}prefix + p${RESET} ${TEXT}Shell temporário em popup${RESET} ${GREEN}prefix + J${RESET} ${TEXT}Traz pane de outra janela${RESET} + ${GREEN}prefix + P${RESET} ${TEXT}Executa comando em popup${RESET} ${GREEN}prefix + S${RESET} ${TEXT}Envia pane pra outra janela${RESET} + ${GREEN}prefix + t${RESET} ${TEXT}Scratch terminal persistente${RESET} ${GREEN}prefix + B${RESET} ${TEXT}Pane vira janela independente${RESET} + ${GREEN}prefix + h${RESET} ${TEXT}Abre este cheatsheet${RESET} + +${YELLOW} Sessão${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}prefix + d${RESET} ${TEXT}Desconecta da sessão (continua em background)${RESET} + ${GREEN}prefix + r${RESET} ${TEXT}Recarrega ~/.tmux.conf${RESET} + +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${DIM}${OVERLAY}[b] Voltar [/] Buscar [Esc] Vim mode [q] Fechar${RESET}" } show_claude() { clear - cat << 'EOF' -╭─────────────────────────────────────────────────────────────╮ -│ [2] CLAUDE CLI │ -├─────────────────────────────────────────────────────────────┤ -│ COMANDOS │ -│ ──────── │ -│ claude Iniciar conversa │ -│ claude -c Continuar última conversa │ -│ claude -r Continuar mais recente │ -│ claude "prompt" Prompt direto │ -│ claude -p "prompt" Modo print (sem interativo) │ -│ cat file | claude Pipe de arquivo │ -├─────────────────────────────────────────────────────────────┤ -│ DENTRO DA CONVERSA │ -│ ────────────────── │ -│ /help Ajuda │ -│ /clear Limpar contexto │ -│ /compact Compactar histórico │ -│ /config Configurações │ -│ /cost Ver custo da sessão │ -│ /doctor Diagnóstico │ -│ /quit ou Ctrl+C Sair │ -├─────────────────────────────────────────────────────────────┤ -│ ATALHOS NO ALACRITTY (úteis com Claude) │ -│ ─────────────────────────────────────── │ -│ Ctrl+Shift+Space Vi mode - navegar output longo │ -│ Ctrl+Shift+F Buscar no output │ -│ Ctrl+Shift+U Clicar em URLs do output │ -│ Ctrl+Shift+O Abrir paths no VS Code │ -│ Scroll: 50k linhas Histórico grande pra outputs │ -╰─────────────────────────────────────────────────────────────╯ - [b] Voltar [q] Fechar -EOF + echo -e "${PINK}${BOLD} ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮${RESET} +${PINK}${BOLD} │${RESET}${TEXT}${BOLD} CLAUDE CLI ${RESET}${PINK}${BOLD}│${RESET} +${PINK}${BOLD} ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯${RESET} + +${YELLOW} Iniciando Conversas${RESET} ${YELLOW}Slash Commands ${DIM}(dentro da conversa)${RESET} +${OVERLAY} ───────────────────────────────────────────────── ─────────────────────────────────────────────────${RESET} + ${GREEN}claude${RESET} ${TEXT}Nova conversa interativa${RESET} ${GREEN}/help${RESET} ${TEXT}Mostra ajuda completa${RESET} + ${GREEN}claude -c${RESET} ${TEXT}Continua última do diretório${RESET} ${GREEN}/clear${RESET} ${TEXT}Limpa contexto da conversa${RESET} + ${GREEN}claude -r${RESET} ${TEXT}Continua mais recente${RESET} ${GREEN}/compact${RESET} ${TEXT}Compacta histórico${RESET} + ${GREEN}claude \"prompt\"${RESET} ${TEXT}Prompt direto + interativo${RESET} ${GREEN}/config${RESET} ${TEXT}Menu de configurações${RESET} + ${GREEN}claude -p \"...\"${RESET} ${TEXT}Executa e retorna (scripts)${RESET} ${GREEN}/cost${RESET} ${TEXT}Custo em tokens/dinheiro${RESET} + ${GREEN}cat f | claude${RESET} ${TEXT}Arquivo como contexto${RESET} ${GREEN}/doctor${RESET} ${TEXT}Diagnóstico de problemas${RESET} + ${GREEN}/quit${RESET} ${TEXT}Encerra sessão${RESET} + +${YELLOW} Dicas de Uso com Alacritty${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}Ctrl+Shift+Space${RESET} ${TEXT}Vi mode pra navegar outputs longos${RESET} + ${GREEN}Ctrl+Shift+F${RESET} ${TEXT}Busca texto nas respostas${RESET} + ${GREEN}Ctrl+Shift+U${RESET} ${TEXT}Destaca URLs clicáveis${RESET} + +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${DIM}${OVERLAY}[b] Voltar [/] Buscar [Esc] Vim mode [q] Fechar${RESET}" } show_vim() { clear - cat << 'EOF' -╭─────────────────────────────────────────────────────────────╮ -│ [3] VIM │ -├─────────────────────────────────────────────────────────────┤ -│ BÁSICO (leader = Espaço) │ -│ ──────────────────────── │ -│ leader + w Salvar (:w) │ -│ leader + q Fechar (:q) │ -│ leader + f Buscar arquivos (fzf) │ -│ leader + / Buscar conteúdo (rg) │ -│ leader + b Listar buffers │ -│ Esc Limpar highlight da busca │ -├─────────────────────────────────────────────────────────────┤ -│ PLUGINS │ -│ ─────── │ -│ gcc Comentar/descomentar linha │ -│ gc{motion} Comentar região (ex: gcap) │ -│ cs'" Trocar ' por " (surround) │ -│ ds" Deletar aspas │ -│ ysiw" Adicionar " em volta da palavra │ -├─────────────────────────────────────────────────────────────┤ -│ NAVEGAÇÃO │ -│ ───────── │ -│ Ctrl+o / Ctrl+i Voltar / avançar posição │ -│ gd Ir para definição │ -│ * Buscar palavra sob cursor │ -│ % Ir para bracket correspondente │ -╰─────────────────────────────────────────────────────────────╯ - [b] Voltar [q] Fechar -EOF + echo -e "${PEACH}${BOLD} ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮${RESET} +${PEACH}${BOLD} │${RESET}${TEXT}${BOLD} VIM ${DIM}(leader = Espaço) ${RESET}${PEACH}${BOLD}│${RESET} +${PEACH}${BOLD} ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯${RESET} + +${YELLOW} Comandos Básicos${RESET} ${YELLOW}Plugins - Comentários e Surround${RESET} +${OVERLAY} ───────────────────────────────────────────────── ─────────────────────────────────────────────────${RESET} + ${GREEN}leader + w${RESET} ${TEXT}Salva arquivo (:w)${RESET} ${GREEN}gcc${RESET} ${TEXT}Comenta/descomenta linha${RESET} + ${GREEN}leader + q${RESET} ${TEXT}Fecha janela/buffer (:q)${RESET} ${GREEN}gc{motion}${RESET} ${TEXT}Comenta região (gcap, gcG)${RESET} + ${GREEN}leader + f${RESET} ${TEXT}Fuzzy finder de arquivos${RESET} ${GREEN}cs'\"${RESET} ${TEXT}Troca ' por \" (surround)${RESET} + ${GREEN}leader + /${RESET} ${TEXT}Busca no projeto (ripgrep)${RESET} ${GREEN}ds\"${RESET} ${TEXT}Remove aspas${RESET} + ${GREEN}leader + b${RESET} ${TEXT}Lista buffers abertos${RESET} ${GREEN}ysiw\"${RESET} ${TEXT}Adiciona \" na palavra${RESET} + ${GREEN}Esc${RESET} ${TEXT}Limpa highlight da busca${RESET} + +${YELLOW} Navegação${RESET} +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${GREEN}Ctrl+o${RESET} ${TEXT}Volta posição anterior no jumplist${RESET} + ${GREEN}Ctrl+i${RESET} ${TEXT}Avança posição no jumplist${RESET} + ${GREEN}gd${RESET} ${TEXT}Vai para definição (LSP)${RESET} + ${GREEN}*${RESET} ${TEXT}Busca palavra sob cursor${RESET} + ${GREEN}%${RESET} ${TEXT}Pula entre parênteses/chaves${RESET} + +${OVERLAY} ──────────────────────────────────────────────────────────────────────────────────────────────────────${RESET} + ${DIM}${OVERLAY}[b] Voltar [/] Buscar [Esc] Vim mode [q] Fechar${RESET}" +} + +handle_section() { + local show_func="$1" + while true; do + $show_func + read -n 1 -s key + case $key in + b) return ;; + q) exit 0 ;; + /) show_search ;; + $'\e') # Escape - vim mode com less + $show_func 2>&1 | less -R --no-init --quit-if-one-screen +G + ;; + esac + done } while true; do show_menu read -n 1 -s key case $key in - 1) - while true; do - show_alacritty - read -n 1 -s key - [[ $key == "b" ]] && break - [[ $key == "q" ]] && exit 0 - done - ;; - 2) - while true; do - show_claude - read -n 1 -s key - [[ $key == "b" ]] && break - [[ $key == "q" ]] && exit 0 - done - ;; - 3) - while true; do - show_vim - read -n 1 -s key - [[ $key == "b" ]] && break - [[ $key == "q" ]] && exit 0 - done - ;; - q) - exit 0 - ;; + 1) handle_section show_alacritty ;; + 2) handle_section show_tmux ;; + 3) handle_section show_claude ;; + 4) handle_section show_vim ;; + /) show_search ;; + q) exit 0 ;; esac done