fcard is a terminal user interface (TUI) flashcard application written in Rust. It uses the SM-2 spaced repetition algorithm to help you memorize information efficiently.
All flashcard decks are stored as plain text files on your computer. You can write and edit decks in Markdown, YAML, or JSON using any text editor, or add and delete cards directly inside the application.
- Description
- Features
- Requirements
- Installation
- Quick Start
- Command-Line Options
- Supported Deck Formats
- Modes of Operation
- Keybindings and Controls
- Spaced Repetition and Scoring
- Themes
- Configuration and Data Storage
fcard gives you a fast, keyboard-driven study environment inside your terminal. It is built using Ratatui and Crossterm.
Unlike proprietary flashcard apps that store data in closed formats or cloud databases, fcard reads your flashcards directly from human-readable text files in your project or note directories. Review statistics and scheduling data are kept locally on your machine.
- Multiple File Formats: Create decks using Markdown (
.md), YAML (.yaml,.yml), or JSON (.json). - SM-2 Spaced Repetition: Schedules reviews based on your recall performance so you review cards right before you forget them.
- Learn Mode: Type answers to test active recall. Includes fuzzy string matching, typo tolerance, and a color-coded character diff that shows where your answer differed.
- Flashcard Mode: Traditional study mode where you flip cards and rate your recall from 1 to 4.
- In-App Editing: Add new cards through a popup dialog or launch your system text editor directly from the app.
- Search: Search across question prompts, answers, and tags with real-time highlighting and match navigation.
- Vim-Style Navigation: Navigate panes, decks, and cards using standard keys (
h,j,k,l,gg,G,Ctrl+d,Ctrl+u,/,:). - Multiple Themes: Switch between 7 built-in themes including Catppuccin Mocha, Dracula, Tokyo Night, Nord, Solarized Dark, High Contrast, and default Terminal.
- Position Persistence: Automatically remembers which card you were viewing in each deck between sessions.
- Rust: Version 1.85.0 or later (edition 2024 support is required).
- Cargo: Standard Rust package manager.
- Operating System: Linux, macOS, or Android (via Termux).
- Optional: A text editor set in your
EDITORorVISUALenvironment variable (defaults tonvim).
-
Clone or download this repository:
git clone <repository-url> fcard cd fcard
-
Build the release binary:
cargo build --release
-
The compiled binary will be placed at
target/release/fcard. You can copy it to a directory in yourPATH:cp target/release/fcard ~/.local/bin/
You can install the binary directly into ~/.cargo/bin:
cargo install --path .Ensure ~/.cargo/bin is in your shell PATH.
-
Create a sample Markdown deck:
fcard init geography.md
-
Launch fcard to view all decks in the current directory:
fcard
-
Or launch fcard with a specific deck:
fcard geography.md
-
Inside the application:
- Use
jandkto move between cards. - Press
Tabto switch between the Deck List, Card List, and Preview panes. - Press
Enterto enter Flashcard Mode. - Press
Spaceto flip a card. - Press
1through4to record your rating. - Press
lto enter Learn Mode and type your answers. - Press
rto enter Spaced Repetition Mode to review due cards. - Press
qto return or quit.
- Use
Usage: fcard [OPTIONS] [DECKS]... [COMMAND]
Arguments:
[DECKS]... Paths to deck files or directories to load
Options:
-p, --path <PATH> Path to a deck file or directory
-t, --theme <THEME> Theme to use (terminal, catppuccin, dracula, tokyo-night,
solarized-dark, nord, high-contrast)
-h, --help Print help
-V, --version Print version
Commands:
init Create a new template deck file (detects format from extension)
edit Open an existing deck file in your text editor
- If you pass file paths directly as arguments, fcard loads them immediately.
- If you pass a directory (or run
fcardwith no arguments to scan the current directory), fcard scans subdirectories recursively. To prevent loading unrelated documents, recursive scanner only loads files that contain an#fcardmarker anywhere in the file (such as#fcard,# fcard, or<!-- fcard -->).
Markdown files are identified by .md or .markdown.
# #fcard
# Capital Cities of the World
Study guide for world capitals.
## France
Front: What is the capital of France?
Back: Paris
Hints: Located on the River Seine.
Tags: geography, europe
## Japan
Front: What is the capital of Japan?
Back: Tokyo
Hints: Formerly known as Edo.
Tags: geography, asiaField labels supported:
- Front:
Front:,Q:,Question: - Back:
Back:,A:,Answer: - Hints:
Hint:,Hints:(comma-separated list) - Tags:
Tag:,Tags:(comma-separated list)
# #fcard
# Chemistry Basics
## Water Molecule
### Front
What is the chemical formula for water?
### Back
H2OIf no field prefixes or subheadings are present, the level 2 header (##) becomes the question front, and the text below it becomes the answer back:
# #fcard
# Vocabulary
## Ephemeral
Lasting for a very short time; fleeting.
## Ubiquitous
Present, appearing, or found everywhere.JSON files are identified by .json. You can place #fcard as a comment on the very first line.
#fcard
{
"title": "Rust Programming Basics",
"description": "Core syntax and language concepts.",
"cards": [
{
"front": "What keyword is used to declare an immutable variable in Rust?",
"back": "let",
"hints": ["It has three letters."],
"tags": ["basics", "variables"]
},
{
"front": "How do you declare a constant in Rust?",
"back": "const",
"hints": ["Requires an explicit type annotation."],
"tags": ["basics", "constants"]
}
]
}YAML files are identified by .yaml or .yml.
# #fcard
title: Rust Programming Basics
description: Core syntax and language concepts.
cards:
- front: What keyword is used to declare an immutable variable in Rust?
back: let
hints:
- It has three letters.
tags:
- basics
- variables
- front: How do you declare a constant in Rust?
back: const
hints:
- Requires an explicit type annotation.
tags:
- basics
- constantsThe default mode upon opening the app.
- View decks on the top left.
- View deck statistics in the middle left.
- View the card list on the bottom left.
- Preview question prompts, answers, hints, and tags in the main view pane on the right.
Traditional self-paced study.
- Press
Enterfrom Browse Mode to start. - Press
Spaceto reveal the back of the card. - Press
1,2,3, or4to grade your recall:1: Again (Failed recall; interval resets to 1 day)2: Hard (Difficult recall)3: Good (Correct recall; normal interval increase)4: Easy (Immediate recall; larger interval increase)
- Press
sto shuffle the cards.
Active recall practice with typing and automated grading.
- Press
lfrom Browse Mode to start. - Type your answer into the prompt.
- Press
Enter(for single-line answers) orCtrl+Enter/Ctrl+s(for multi-line answers) to submit. - The matcher compares your input with the expected answer:
- Scores of 75% match or higher are accepted.
- A color-coded character diff shows exact matches, missing characters, and incorrect additions.
- Cards you miss are placed back into the queue until you answer them correctly.
Review only the cards that are scheduled for review today based on SM-2 calculation.
- Press
rfrom Browse Mode to start. - If no cards are due, a message informs you that your deck is up to date.
- Review and rate cards as in Flashcard Mode.
| Key | Action |
|---|---|
Tab / Right |
Move focus to the next pane |
BackTab / Left |
Move focus to the previous pane |
j / Down |
Move selection down / Next card |
k / Up |
Move selection up / Previous card |
gg / H |
Jump to the first item |
G |
Jump to the last item |
M |
Jump to the middle item |
Ctrl+d |
Scroll down half a page |
Ctrl+u |
Scroll up half a page |
Enter |
Open Flashcard Mode (from Browse Mode) |
l |
Open Learn Mode |
r |
Open Spaced Repetition Mode |
s |
Shuffle deck |
S |
Restore original deck order |
a |
Add new card to current deck |
d |
Delete currently selected card |
e |
Open current deck in external text editor |
t |
Open Theme Picker menu |
T |
Cycle to the next theme |
/ |
Start text search |
: |
Open Command bar |
q / Esc |
Return to Browse Mode or quit application |
Ctrl+c |
Force quit |
Press / from Browse Mode to start searching.
| Key | Action |
|---|---|
Type text |
Enter search term |
Enter |
Execute search and filter matches |
n |
Jump to next matching card |
N |
Jump to previous matching card |
Esc |
Press once to view status; press twice to clear search filter |
Press : from Browse Mode to open the command line.
| Command | Action |
|---|---|
:w or :write |
Save statistics and configuration to disk |
:q or :quit |
Exit the program |
:wq or :x |
Save and exit |
:set theme=<name> |
Switch theme (e.g. :set theme=nord) |
:theme <name> |
Alternative syntax to set theme |
:s or :shuffle |
Shuffle the current deck |
:S or :unshuffle |
Reset cards to original file order |
:l or :learn |
Enter Learn Mode |
:fc or :flashcard |
Enter Flashcard Mode |
:r or :review |
Enter Spaced Repetition Mode |
:a or :add |
Open the Add Card popup |
:d or :delete |
Delete the currently selected card |
:e or :edit |
Edit deck file in external editor |
:reset |
Reset review statistics and intervals for the active deck |
:h or :help |
Show command list summary |
Press a to open the card creation window.
| Key | Action |
|---|---|
Tab / Up / Down |
Switch between Front (Question) and Back (Answer) |
Enter |
Advance to Back field, or save card if in Back field |
Ctrl+s / Ctrl+Enter |
Save card immediately |
Esc |
Cancel and close dialog |
fcard implements the SuperMemo-2 (SM-2) algorithm:
- Repetitions: Tracks how many times in a row you have successfully recalled a card.
- Interval: The number of days until the card is scheduled for review.
- First successful recall: 1 day.
- Second successful recall: 6 days.
- Subsequent recalls:
Previous Interval * Ease Factor.
- Ease Factor (EF): A multiplier representing card difficulty. Starts at
2.5and never drops below1.3.- Quality ratings of 4 or 5 increase the Ease Factor.
- Quality ratings below 3 reset the repetition count and set the review interval back to 1 day.
In Learn Mode, text matching is scored between 0.0 and 1.0 using character-level longest common subsequence comparison:
Score >= 0.90: Rated "Correct" (Quality 4)Score >= 0.75: Rated "Close enough" (Quality 4)Score >= 0.50: Rated "Almost - check spelling" (Quality 1 - repeats in queue)Score < 0.50: Rated "Incorrect" (Quality 1 - repeats in queue)
fcard includes 7 built-in color schemes:
terminal(Uses your default terminal colors)catppuccin-mochadraculatokyo-nightsolarized-darknordhigh-contrast
Themes can be changed:
- From CLI:
fcard -t dracula - In-app via picker: Press
t, select with arrows, and pressEnter. - In-app via command:
:set theme=tokyo-night - Quick cycle: Press
Tto cycle through available themes.
Your chosen theme is saved and remembered automatically.
fcard stores application data in your system configuration directory:
- Linux / Termux:
~/.config/fcard/ - macOS:
~/Library/Application Support/com.fcard.fcard/
Files stored:
config.json: Contains your selected theme and the last active card index for each deck.stats.json: Contains SM-2 metrics (repetition counts, ease factors, intervals, review timestamps, correct/incorrect counters) keyed by card ID.
Because statistics are separated from deck files, your Markdown, YAML, and JSON deck files remain clean and easy to edit or track in git.