Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created December 10, 2025 03:53
Show Gist options
  • Select an option

  • Save johnlindquist/aa366878f79e6c00b2d207f4d5b74393 to your computer and use it in GitHub Desktop.

Select an option

Save johnlindquist/aa366878f79e6c00b2d207f4d5b74393 to your computer and use it in GitHub Desktop.
Mnemonic zsh shortcuts for GitHub Copilot CLI with multiple AI models

GitHub Copilot CLI Shortcuts for Zsh

Mnemonic shell functions for launching GitHub Copilot CLI with different models and modes.

Quick Reference

Prompt Mode Interactive Mode Model
p pi Claude Opus 4.5
ps pis Claude Sonnet 4.5
ph pih Claude Haiku 4.5
po pio OpenAI GPT-5.1
pg pig Gemini 3 Pro
Command Action
pcon Continue most recent session
pres Resume with session picker

Mnemonics

  • P = Pilot (Copilot)
  • I = Interactive
  • S = Sonnet
  • H = Haiku
  • O = OpenAI
  • G = Gemini
  • CON = Continue
  • RES = Resume

Usage Examples

# Quick one-off prompt (exits after response)
p "explain this error message"
ph "what does this regex do"  # Use cheap/fast Haiku

# Interactive session (stays open for conversation)
pi                           # Start interactive with Opus
pis "help me refactor this"  # Start Sonnet with initial prompt

# Resume previous work
pcon                         # Continue most recent session
pres                         # Pick a session to resume

Installation

Add this to your .zshrc or a file in your zsh config directory:

# =============================================================================
# GitHub Copilot CLI Shortcuts
# =============================================================================
# Mnemonic: P = Pilot, PI = Pilot Interactive, PCON = continue, PRES = resume
# Suffixes: (none)=Opus, s=Sonnet, h=Haiku, o=OpenAI, g=Gemini
# =============================================================================

typeset -gA _PILOT_MODELS=(
  [_]="claude-opus-4.5"
  [s]="claude-sonnet-4.5"
  [h]="claude-haiku-4.5"
  [o]="gpt-5.1"
  [g]="gemini-3-pro-preview"
)

# Generate all pilot functions dynamically
for _suffix _model in ${(kv)_PILOT_MODELS}; do
  if [[ $_suffix == "_" ]]; then
    # Default (no suffix): p, pi
    eval "p()  { copilot --model $_model --allow-all-tools --silent -p \"\$@\"; }"
    eval "pi() { copilot --model $_model --allow-all-tools \${1:+-i} \"\$@\"; }"
  else
    # With suffix: ps, pis, ph, pih, etc.
    eval "p${_suffix}()  { copilot --model $_model --allow-all-tools --silent -p \"\$@\"; }"
    eval "pi${_suffix}() { copilot --model $_model --allow-all-tools \${1:+-i} \"\$@\"; }"
  fi
done
unset _suffix _model

# Session management (model-agnostic)
pcon() { copilot --allow-all-tools --continue; }
pres() { copilot --allow-all-tools --resume "$@"; }

Adding New Models

To add a new model, just add an entry to _PILOT_MODELS:

_PILOT_MODELS[c]="gpt-5.1-codex"  # Creates pc() and pic()

Then re-source your config.

Available Models (as of Dec 2025)

claude-sonnet-4.5, claude-haiku-4.5, claude-opus-4.5, claude-sonnet-4
gpt-5, gpt-5.1, gpt-5.1-codex-mini, gpt-5.1-codex-max, gpt-5.1-codex, gpt-5-mini, gpt-4.1
gemini-3-pro-preview

Prerequisites

Flags Used

Flag Purpose
--model Select the AI model
--allow-all-tools Auto-approve tool usage
--silent Output only the response (no stats)
-p Non-interactive prompt mode
-i Interactive mode with optional initial prompt
--continue Resume most recent session
--resume Pick a session to resume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment