Word Counter Session

pending

by MingMing

Track newly added words in your writing session with timer support and status bar display.

Updated 2mo ago0BSDDiscovered via Obsidian Unofficial Plugins
View on GitHub

Word Counter Session

An Obsidian plugin that tracks newly added words during your writing session with optional timer support.

https://github.com/user-attachments/assets/3000a541-e7a2-4b1c-809d-311198694736

Features

  • Word Count Tracking: Track words added or removed in current writing session
  • Timer Support: Optional timer to measure your writing time
  • Smart Word Counting: Consistent with Obsidian's built-in word counter
    • Filters out Markdown syntax (links, images, URLs, etc.)
    • Supports CJK characters (Chinese, Japanese, Korean) - each character counts as 1 word
    • Treats alphanumeric sequences as words
  • Status Bar Display: Shows word count difference and elapsed time in status bar
  • Sleep Mode: Automatically pauses tracking when switching to another file
  • Auto-Stop: Option to automatically stop tracking after a period of inactivity

How to Use

Starting a Session

  1. Open any Markdown file in Obsidian
  2. Click the clock icon in the status bar or use the command Toggle word counter session
  3. The plugin will start tracking word count changes from that point
  4. A positive number (e.g., +42) shows words added; negative shows words removed

Timer

  • If enabled, the timer displays elapsed time next to the word count
  • Click the timer to pause/resume it
  • Timer automatically pauses when switching files (if "Pause timer on file switch" is enabled)

Stopping a Session

Click the word count display in the status bar or use the command Toggle word counter session again.

Settings

Access settings via Settings > Community Plugins > Word Counter Session Settings:

  • Enable timer: Display elapsed time alongside word count (default: enabled)
  • Pause timer on file switch: Pause timer when switching to another file or closing the editor (default: enabled)
  • Enable auto-stop: Automatically stop tracking after a period of inactivity (default: disabled)
  • Auto-stop timeout (minutes): Stop tracking after this many minutes of no word count changes (default: 5)

Commands

  • Toggle word counter session: Start or stop tracking of current file
  • Pause/resume timer: Pause or resume the timer (only available when tracking)

Word Counting Algorithm

The plugin counts words consistently with Obsidian's built-in counter:

  1. Removes Markdown syntax:
    • Images: ![alt](url)
    • Links: [text](url) - only counts text
    • WikiLinks: [[link|alias]] - only counts alias
    • Embeds: ![[link]]
    • URLs: https://example.com
  2. Counts CJK characters as words (each character = 1 word)
  3. Matches continuous alphanumeric sequences as words

Examples:

  • this_is_a_test → 4 words
  • AsyncGenerator[int] → 2 words
  • file.txt → 2 words
  • don't → 2 words (don, t)

Installation

Automatic Installation (from Community Plugins)

Once this plugin is published to the Obsidian community plugin list:

  1. Go to Settings > Community Plugins
  2. Search for "Word Counter Session"
  3. Click Install
  4. Enable the plugin

Manual Installation

  1. Download the latest release from GitHub Releases
  2. Extract the downloaded files
  3. Copy manifest.json, main.js, and styles.css to your vault's .obsidian/plugins/word-counter-session/ folder
  4. Reload Obsidian and enable the plugin in Settings > Community Plugins

Development

# Install dependencies
npm install

# Development build with watch mode
npm run dev

# Production build
npm run build

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

License

MIT License - see LICENSE for details.

Credits

Created by MingMing

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.