Fig adds autocomplete to your terminal.
As you type, Fig pops up subcommands, options, and contextually relevant arguments in your existing terminal on macOS.
A completion spec is a declarative schema that specifies the subcommands
, options
and arguments
for a CLI tool. We use these schemas to generate suggestions.
Use the steps below or follow our getting started guide: fig.io/docs
Prerequisites:
- Download Fig for macOS
- Node and NPM (or Yarn).
Steps
-
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.
# 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:
- new completion specs
- errors with existing completion specs (e.g. missing subcomannds, options, or arguments)
- generators for argument suggestions
- better descriptions, icons etc
- themes!
If you aren't able to contribute, please feel free to open an issue. Most people think that contributing will be too hard, but you'd be surprised, we have deliberately made contributing very very easy. Give it a go!
Fig works with the native MacOS Terminal app, iTerm, Tabby, Hyper and the integrated terminal in VSCode. We are adding support for Alacritty, Kitty, and the integrated terminals in JetBrains very soon.
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.
Run 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.
Check out our How to Contribute guide. Many of Fig's 150+ contributors made their first open source contribution to Fig!
Get in touch at hello@fig.io or chat with us in Discord.