تخطَّ إلى المحتوى

Fig Cheat Sheet

Overview

Fig (now part of Amazon Q Developer) adds IDE-style autocomplete to your terminal. It provides visual autocomplete suggestions for CLI tools, commands, arguments, and file paths as you type. Fig works with popular shells including bash, zsh, and fish, and integrates with terminals like iTerm2, Hyper, VS Code terminal, and the built-in macOS Terminal.

Fig evolved from an independent product into Amazon Q Developer for command line, which extends the original autocomplete with AI-powered natural language to bash translation, inline completions, and chat capabilities. The autocomplete spec system remains community-driven with thousands of CLI tools supported through a public specification repository.

Installation

macOS (Primary Platform)

# Install via Homebrew
brew install --cask amazon-q

# Or download directly from https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line.html

# After installation, run setup
q integrations install input-method
q integrations install dotfiles

Linux

# Download the AppImage or .deb package from the Amazon Q website
# For Debian/Ubuntu
sudo dpkg -i amazon-q-developer_amd64.deb

# For RPM-based distros
sudo rpm -i amazon-q-developer.x86_64.rpm

Shell Integration

# Verify shell integration is active
q integrations status

# Manually add to your shell profile if needed
# For zsh (~/.zshrc)
eval "$(q integrations install --shell zsh)"

# For bash (~/.bashrc)
eval "$(q integrations install --shell bash)"

# For fish (~/.config/fish/config.fish)
q integrations install --shell fish | source

Core Features

Autocomplete Navigation

KeyAction
TabAccept the highlighted suggestion
EnterAccept and execute
/ Navigate suggestions
EscDismiss suggestions
Ctrl+SpaceManually trigger autocomplete
Accept inline ghost text suggestion
Ctrl+IToggle AI inline completion

Supported Tools (Partial List)

CategoryTools
Package managersnpm, yarn, pip, brew, apt, cargo
Version controlgit, gh, hub, gitflow
Cloudaws, gcloud, az, terraform, kubectl
Containersdocker, docker-compose, podman
Languagesnode, python, ruby, go, rustc
Utilitiescurl, jq, sed, awk, grep, find
Editorsvim, code, nano, emacs
Remotessh, scp, rsync

CLI Commands

# Check status
q status

# Open settings
q settings

# Update to latest version
q update

# Toggle autocomplete on/off
q autocomplete enable
q autocomplete disable

# View diagnostic info
q diagnostic

# Restart the background process
q restart

# Uninstall
q uninstall

Configuration

Settings

# Open settings UI
q settings

# Or configure via CLI
q settings autocomplete.theme "dark"
q settings autocomplete.width 320
q settings autocomplete.height 200

# Disable autocomplete for specific tools
q settings autocomplete.disabled-tools "['rm', 'sudo']"

Dotfile Integration

# Fig/Q can sync your dotfiles
q integrations install dotfiles

# Manage aliases and functions
q dotfiles

# Add custom aliases that get autocomplete support
# ~/.config/q/aliases.sh
alias k='kubectl'
alias g='git'
alias dc='docker compose'
alias tf='terraform'

Autocomplete Display Settings

// ~/.config/q/settings.json
{
  "autocomplete.theme": "dark",
  "autocomplete.width": 320,
  "autocomplete.sortMethod": "recency",
  "autocomplete.fuzzySearch": true,
  "autocomplete.immediatelyRunDangerousCommands": false,
  "autocomplete.scrollWrapAround": true,
  "autocomplete.insertSpaceAutomatically": true
}

Advanced Usage

Custom Completion Specs

// ~/.config/q/autocomplete/my-tool.ts
const completionSpec: Fig.Spec = {
  name: "my-tool",
  description: "My custom CLI tool",
  subcommands: [
    {
      name: "deploy",
      description: "Deploy the application",
      options: [
        {
          name: ["--env", "-e"],
          description: "Target environment",
          args: {
            suggestions: ["dev", "staging", "production"],
          },
        },
        {
          name: ["--region", "-r"],
          description: "AWS region",
          args: {
            generators: {
              script: ["aws", "ec2", "describe-regions", "--query", "Regions[].RegionName", "--output", "text"],
              postProcess: function (out) {
                return out.split("\t").map(region => ({
                  name: region,
                  description: `AWS ${region}`,
                }));
              },
            },
          },
        },
      ],
    },
    {
      name: "logs",
      description: "View application logs",
      options: [
        {
          name: "--follow",
          description: "Follow log output",
        },
        {
          name: "--lines",
          description: "Number of lines to show",
          args: { default: "100" },
        },
      ],
    },
  ],
};

export default completionSpec;

AI Chat and Translation

# Natural language to command translation
q chat "find all Python files modified in the last week"
# Suggests: find . -name "*.py" -mtime -7

q chat "compress all PNG files in this directory"
# Suggests: for f in *.png; do pngquant "$f"; done

# Interactive AI chat for CLI help
q chat
> How do I set up SSH key forwarding?

Script Autocomplete

# Add Fig annotations to shell scripts for autocomplete
#!/bin/bash
# @fig-autocomplete

# @arg --name <string> "The deployment name"
# @arg --replicas <number> "Number of replicas"
# @flag --dry-run "Preview without applying"
deploy() {
  echo "Deploying $name with $replicas replicas"
}

Terminal Plugin System

# List available plugins
q plugins list

# Install a plugin
q plugins install git-open

# Remove a plugin
q plugins remove git-open

Troubleshooting

IssueSolution
Autocomplete not appearingRun q diagnostic and check for issues; restart with q restart
Slow suggestionsDisable fuzzy search or reduce suggestion count in settings
Wrong shell detectedRun q integrations install --shell zsh for your specific shell
Conflicts with other toolsCheck for conflicting keybindings; disable other completion plugins
Autocomplete flashingUpdate to the latest version; check terminal compatibility
Not working in VS CodeEnsure the terminal integration is enabled: q integrations install vscode
High CPU usageRun q restart; check for runaway generator scripts
Specs outdatedRun q autocomplete update to pull latest completion specs
Permission errors on installCheck that ~/.config/q/ is writable; fix with chmod -R u+rw ~/.config/q/