Optimizing Novel Word Count Plugin for Git Users

Introduction

Novel Word Count is a useful Obsidian plugin that displays file information directly in the file explorer. I primarily use it to monitor image file sizes, allowing me to identify large files without opening Windows Explorer or macOS Finder.

The Problem: Storage Bloat

The plugin stores file metadata alongside settings in a single JSON file, with each file adding approximately 27 lines of data. This quickly becomes problematic:

  • 500 files = 13,500 extra lines
  • Creates disk space issues, especially for Git and Obsidian Sync users
  • Can cause unnecessary merge conflicts in multi-device workflows

The developer has confirmed no plans to separate settings from cache or disable caching, so we need alternative solutions.

Simple Solution: Git Ignore

For Git users, add the plugin’s data file to your .gitignore:

.obsidian/plugins/novel-word-count/data.json

Considerations:

  • When setting up a new device, you’ll need to reconfigure plugin settings
  • Keep notes on your preferred settings for easy restoration
  • This approach works well for most users

Restoring the Plugin Settings (Advanced)

Once Novel Word Count is installed:

  1. In your Obsidian vault, create a new JavaScript file inside the .obsidian folder. For this guide, let’s name it: .obsidian/scripts/setNovelWordCountSettings.js
  2. Open setNovelWordCountSettings.js and copy its entire content into the new file you just created.
    This script includes my preferred plugin settings, feel free to adjust yours by editing the settings constant.
  3. Open Obsidian, then show the Developer Tools by pressing Ctrl/Cmd + Shift + I.
  4. Go to the Console tab and run the following command:
    eval(await app.vault.adapter.read('.obsidian/scripts/setNovelWordCountSettings.js'))
  5. A confirmation modal will appear, and some messages will be logged in the console.
    • Warnings may appear if your script includes settings that don’t exist.
    • If no warnings or errors appear, click OK to apply the settings.

That’s it! You should now see the updated file details in the file explorer.