Fig adds autocomplete to your terminal.
As you type, Fig pops up subcommands, options, and contextually relevant arguments in your existing terminal on macOS.
With Homebrew:
brew install --cask fig
Download the macOS app at fig.io/download.
Want to add autocomplete to a CLI tool (or make changes to an existing autocomplete spec)? We welcome contributions!
Completion specs are defined in a declarative schema that specifies subcommands
, options
and arguments
. Suggestions are generated from information in the spec or can be generated dynamically by running shell commands or reading local files.
For documentation and tutorials, visit fig.io/docs.
To request autocomplete for a CLI tool, open an issue.
Build your first spec in 3 min or less: fig.io/docs/getting-started
Prerequisites:
- Early access to the Fig macOS app.
If you don't have access yet, sign up for the waitlist and say you're interested in building completions!
- Node and NPM (or Yarn).
Setup:
-
Click here to fork this repo.
-
Clone your forked repo and create an example spec
# Replace `YOUR_GITHUB_USERNAME` with your own github username
git clone https://github.com/YOUR_GITHUB_USERNAME/autocomplete.git fig-autocomplete
cd fig-autocomplete
# Add withfig/autocomplete as a remote
git remote add upstream https://github.com/withfig/autocomplete.git
# Install packages
npm install
# Create an example spec (call it "abc")
npm run create-spec abc
# Turn on "dev mode"
npm run dev
- Now go to your terminal and type
abc[space]
. Your example spec will appear. 😊
- Edit your spec in typescript in the
src/
folder - On save, specs are compiled to the
build/
folder - In dev mode specs are read from the
build
folders. Otherwise they are read from~/.fig/autocomplete
# Typecheck all specs in the src/ folder
npm test
# Compile typescripts specs from src/ folder to build/ folder
npm run build
# Copy all specs from the build/ folder to the ~/.fig/autocomplete folder
npm run copy:all
# Copy an individual spec from the build/ folder to the ~/.fig/autocomplete folder
npm run copy <spec-name>
We would love contributions for
- any other completion spec for CLI tools you use regularly
- generators for existing specs
Never submitted a PR before? Check out our How to Contribute guide. Many of Fig's 100+ contributors made their first open source contribution to Fig too!
Fig works with iTerm, the native MacOS Terminal app, Hyper and the integrated terminal in VSCode.
Fig uses the Accessibility API on Mac to position the window, insert text on your behalf, and read what you've typed in your terminal.
Currently, Fig is only available on MacOS.
Fig is currently in a public beta. You can install Fig by running brew install fig
or by downloading the app at fig.io/download.
Yes! Check out our guide on how to get started building autocomplete specs.
Get in touch at [email protected] or chat with us in Discord.