Skip to content

vaskort/symfreq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

symfreq

Crates.io

A CLI tool for analyzing symbol frequency in source code files.

Motivation

Built to learn Rust while optimizing keyboard layouts for a custom split keyboard. This tool helps identify which symbols appear most frequently in your codebase, making it easier to design efficient key placements.

Installation

With Homebrew (macOS/Linux)

brew tap vaskort/symfreq
brew install symfreq

With Cargo

cargo install symfreq

Usage

Analyze a directory with default extensions (rs, js, jsx, ts, tsx):

symfreq ./src

Specify custom file extensions:

symfreq ./src --exts rs,toml,md

Or use the short flag:

symfreq ./src -e c,h,cpp

Output

The tool displays a summary with statistics and a color-coded table showing each symbol's frequency:

Summary:
  Total tracked symbols: 1159813
  Unique symbols: 32
  Files processed: 2042 read (51.3%), 1940 skipped, 0 failed

┌────────┬─────────┬───────────────────────────┐
│ Symbol │ Percent │ Distribution              │
├────────┼─────────┼───────────────────────────┤
│ "      │ 12.26%  │ ███░░░░░░░░░░░░░░░░░░░░░░ │
│ (      │ 11.85%  │ ██░░░░░░░░░░░░░░░░░░░░░░░ │
│ )      │ 11.85%  │ ██░░░░░░░░░░░░░░░░░░░░░░░ │
│ .      │ 9.64%   │ ██░░░░░░░░░░░░░░░░░░░░░░░ │
│ _      │ 9.19%   │ ██░░░░░░░░░░░░░░░░░░░░░░░ │
└────────┴─────────┴───────────────────────────┘

Color Coding

  • Green - High frequency symbols (≥10%)
  • Yellow - Medium frequency symbols (5-10%)
  • White - Low frequency symbols (<5%)

Options

  • -e, --exts <EXTENSIONS> - Comma-separated list of file extensions to analyze ("rs,ts,tsx")
  • -h, --help - Print help
  • -V, --version - Print version

License

MIT

About

CLI tool to identify the most frequently used symbols in source code built in Rust

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages