Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions CHEATSHEET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# My Terminal Cheat Sheet

## Custom Commands

### Search & AI
- `?` - Google search in Zen browser
- Example: `? how to use tmux`
- `??` - Claude Code query (streaming output)
- Example: `?? explain this code`
- `?? -a` - Claude Code interactive session
- Example: `?? -a help me refactor`

## Tmux Keybindings

### Prefix Key
- `Ctrl+Space` - Prefix key (instead of default Ctrl+b)

### Special Popups
- `Ctrl+Space + g` - Lazygit popup (90% window)
- `Ctrl+Space + ?` - This cheat sheet popup (85% window)

### Menus & Tools
- `Ctrl+Space + \` - Tmux-menus main menu (navigate all tmux features)
- Also accessible via right-click on panes, windows, status bar
- `Ctrl+Space + Ctrl+f` - Tmux-fzf menu (fuzzy search sessions, windows, commands)
- `Ctrl+Space + Backspace` - Command palette (shows all available keybindings)
- `Ctrl+Space + Alt+m` - Command list palette (shows tmux commands)

### Session Management
- `Ctrl+Space + d` - Detach from session
- `Ctrl+Space + Ctrl+Space` - Switch to last client
- `Ctrl+Space + Space` - Switch to last window

### Window Management
- `Ctrl+Space + c` - New window (in current path)
- `Ctrl+Space + ,` - Rename window
- `Ctrl+Space + <` - Move window left
- `Ctrl+Space + >` - Move window right
- `Ctrl+Space + w` - List windows

### Pane Management
- `Ctrl+Space + |` - Split horizontally
- `Ctrl+Space + -` - Split vertically
- `Ctrl+Space + \` - Full height split horizontal
- `Ctrl+Space + _` - Full width split vertical

### Pane Navigation (Vim-style)
- `Ctrl+Space + h` - Move to left pane
- `Ctrl+Space + j` - Move to down pane
- `Ctrl+Space + k` - Move to up pane
- `Ctrl+Space + l` - Move to right pane

### Pane Resizing
- `Ctrl+Space + Ctrl+h` - Resize pane left
- `Ctrl+Space + Ctrl+j` - Resize pane down
- `Ctrl+Space + Ctrl+k` - Resize pane up
- `Ctrl+Space + Ctrl+l` - Resize pane right

### Pane Actions
- `Ctrl+Space + j` - Join pane from another window
- `Ctrl+Space + z` - Zoom/unzoom pane
- `Ctrl+Space + x` - Kill pane

### Configuration
- `Ctrl+Space + r` - Reload tmux config

## Zsh Keybindings

### History Search
- `Ctrl+r` - FZF history search (fuzzy search all commands)
- `Ctrl+p` - Previous command in history (matching current input)
- `Ctrl+n` - Next command in history (matching current input)

### FZF Integrations
- `Ctrl+t` - Search files/directories (paste to command line)
- `Alt+c` - Change directory with fzf
- `**<TAB>` - Fuzzy completion for files

### Navigation
- `cd <dir>` - Change directory (zoxide enhanced)
- `cd -` - Go to previous directory

## Shell Aliases

### File Listing (eza)
- `ls` - Tree view with icons
- `ll` - Long list with icons
- `la` - Long list with hidden files
- `l` - Long list with git status

### Utilities
- `vim` - Opens helix editor
- `c` - Clear screen
- `sp` - Spotify player

## Tmux Plugins

### Installed Plugins
- `tpm` - Tmux Plugin Manager
- `tmux-sensible` - Sensible default settings
- `dracula/tmux` - Dracula theme
- `tmux-resurrect` - Save/restore sessions
- `tmux-command-palette` - Command palette
- `tmux-tilish` - Tiling window manager keybindings
- `tmux-menus` - Context menus
- `tmux-fzf` - FZF integration

### Plugin Management
- `Ctrl+Space + Shift+I` - Install plugins
- `Ctrl+Space + Shift+U` - Update plugins
- `Ctrl+Space + Alt+u` - Uninstall plugins

## Git (via Oh My Zsh)

### Common Aliases
- `gst` - git status
- `ga` - git add
- `gc` - git commit
- `gp` - git push
- `gl` - git pull
- `gco` - git checkout
- `gcb` - git checkout -b (new branch)
- `glog` - git log with graph

## Tips & Tricks

### Cheat Sheet
- `cheat` - View this cheat sheet
- `cheat -s <term>` - Search cheat sheet for term

### Terminal Multiplexing
- Run `tmux` to start a new session
- Run `tmux attach` or `tmux a` to attach to existing session
- Sessions persist even after closing terminal

### FZF Power User
- Use `Ctrl+r` for fuzzy command history
- Use `**<TAB>` after any command for fuzzy file completion
- Example: `vim **<TAB>` then type part of filename

### Dotfiles Location
- Zsh config: `~/.zshrc` (source: `~/dotfiles/zsh/.zshrc`)
- Tmux config: `~/.config/tmux/tmux.conf` (source: `~/dotfiles/tmux/.config/tmux/tmux.conf`)
- Lazygit config: `~/.config/lazygit/config.yml`
2 changes: 1 addition & 1 deletion tmux/.config/tmux/plugins/tmux
Submodule tmux updated from 332312 to 7ac153
2 changes: 1 addition & 1 deletion tmux/.config/tmux/plugins/tmux-command-palette
Submodule tmux-command-palette updated from 1f5967 to dbcaf7
1 change: 1 addition & 0 deletions tmux/.config/tmux/plugins/tmux-fzf
Submodule tmux-fzf added at 05af76
1 change: 1 addition & 0 deletions tmux/.config/tmux/plugins/tmux-menus
Submodule tmux-menus added at 879f56
9 changes: 8 additions & 1 deletion tmux/.config/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R

# joins pane from another window
bind-key j command-prompt -p "Join pane from window:" "join-pane -h -s '%%'"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
Expand All @@ -63,6 +65,8 @@ set -g @plugin 'dracula/tmux'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'lost-melody/tmux-command-palette'
set -g @plugin 'jabirali/tmux-tilish' # https://github.com/jabirali/tmux-tilish?tab=readme-ov-file#keybindings
set -g @plugin 'jaclu/tmux-menus'
set -g @plugin 'sainnhe/tmux-fzf'

set -g @dracula-show-powerline false
set -g @dracula-show-flags false
Expand Down Expand Up @@ -91,4 +95,7 @@ set -g @dracula-show-location false
#Lazygit popup
bind -r g popup -d '#{pane_current_path}' -E -w 90% -h 90% lazygit

run '~/.tmux/plugins/tpm/tpm'
#Cheat sheet popup
bind -r ? popup -E -w 85% -h 85% "glow -p ~/dotfiles/CHEATSHEET.md"

run '~/.config/tmux/plugins/tpm/tpm'
129 changes: 124 additions & 5 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_QPA_PLATFORMTHEME=qt6ct

# Add fzf to PATH
export PATH="$HOME/.fzf/bin:$PATH"

# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
Expand Down Expand Up @@ -64,13 +66,8 @@ alias la='eza -la --icons'
alias l='eza -la --icons --git'
alias sp='spotify_player'


#alias zed="zeditor"

# Shell integrations
eval "$(fzf --zsh)"
eval "$(zoxide init --cmd cd zsh)"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
Expand Down Expand Up @@ -136,6 +133,119 @@ plugins=(git starship azure docker docker-compose history zsh-interactive-cd ss
source $ZSH/oh-my-zsh.sh
source ~/git-flow-completion.zsh

# Shell integrations (loaded after Oh My Zsh to preserve keybindings)
if [[ $- == *i* ]]; then
eval "$(fzf --zsh)"
eval "$(zoxide init --cmd cd zsh)"
fi
# Custom functions
# Google search in Zen browser
google-search() {
local query="$*"
if [[ -z "$query" ]]; then
echo "Usage: ? <search query>"
return 1
fi
# URL encode the query
local encoded=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$query'''))")
local url="https://www.google.com/search?q=${encoded}"

# Try Zen browser first, fall back to default browser
if command -v zen-browser &> /dev/null; then
zen-browser "$url" &> /dev/null &
elif [[ -f "/mnt/c/Program Files/Zen Browser/zen.exe" ]]; then
"/mnt/c/Program Files/Zen Browser/zen.exe" "$url" &> /dev/null &
else
xdg-open "$url" &> /dev/null &
fi
}

# Claude Code query
claude-query() {
local attach=false

# Check for -a flag
if [[ "$1" == "-a" ]]; then
attach=true
shift
fi

local query="$*"
if [[ -z "$query" ]]; then
echo "Usage: ?? [-a] <claude code query>"
echo " -a Open interactive Claude Code session"
return 1
fi

if [[ "$attach" == true ]]; then
# Interactive mode
claude "$query"
else
# Print mode (streaming output)
claude -p "$query"
fi
}

# Cheat sheet viewer
cheat() {
local cheat_file="$HOME/dotfiles/CHEATSHEET.md"

if [[ ! -f "$cheat_file" ]]; then
echo "Cheat sheet not found at $cheat_file"
return 1
fi

# Check for search flag
if [[ "$1" == "-s" ]]; then
shift
local search_term="$*"
if [[ -z "$search_term" ]]; then
# Interactive search with fzf
if command -v bat &> /dev/null; then
grep -n "." "$cheat_file" | fzf --delimiter=: --preview 'bat --color=always --style=plain --highlight-line {1} '"$cheat_file" --preview-window=+{1}-10
else
grep -n "." "$cheat_file" | fzf --delimiter=: --preview 'sed -n {1}p '"$cheat_file"
fi
else
# Search for specific term
grep -i "$search_term" "$cheat_file" --color=always
fi
elif [[ "$1" == "-p" ]] || [[ -n "$TMUX" && "$1" != "-f" ]]; then
# Show in tmux popup (if in tmux) or with -p flag
if [[ -n "$TMUX" ]]; then
if command -v glow &> /dev/null; then
tmux popup -E -w 85% -h 85% "glow -p '$cheat_file'"
elif command -v bat &> /dev/null; then
tmux popup -E -w 85% -h 85% "bat --style=full --paging=always '$cheat_file'"
else
tmux popup -E -w 85% -h 85% "less '$cheat_file'"
fi
else
# Not in tmux, fall back to regular view
if command -v glow &> /dev/null; then
glow -p "$cheat_file"
elif command -v bat &> /dev/null; then
bat --style=full "$cheat_file"
else
less "$cheat_file"
fi
fi
else
# Regular view with glow, bat or less
if command -v glow &> /dev/null; then
glow -p "$cheat_file"
elif command -v bat &> /dev/null; then
bat --style=full "$cheat_file"
else
less "$cheat_file"
fi
fi
}

# Aliases with noglob to prevent glob expansion
alias '?'='noglob google-search'
alias '??'='noglob claude-query'

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"
Expand Down Expand Up @@ -168,9 +278,18 @@ source ~/git-flow-completion.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# Welcome message (only in interactive shells)
if [[ $- == *i* ]]; then
# Add a small delay to let terminal initialize
sleep 0.1
echo "💡 Tip: Type 'cheat' to view terminal shortcuts (or Ctrl+Space+? in tmux)"
fi

export PATH="/home/seano/.npm-global/bin:$PATH"

. "$HOME/.local/bin/env"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"