A VS Code extension to make editing hledger journal files a bit more fun.
HLedger is an awesome plain text cli accounting tool. This extension adds syntax highlighting, formatting, sorting, and other quality-of-life improvements to make editing these files easier.
- Automatically aligns account names and amounts in hledger journal files
- Autocomplete suggestions based on your account types
- Balancing amount suggestions, press tab to automatically add the balanced amount (
$100 -> -$100) - Rich syntax highlighting with hierarchical account coloring
- Sort journal entries by date (
Shift+Cmd+S) - Handles all supported comment styles (
;,#,*, andcommentblocks) for formatting and toggling - Format on save / Sort on save options (disabled by default)
- Toggle comment lines (
Cmd+/) - Create new monthly journal files (
Cmd+N) - Matches HLedger defaults, but highly configurable to your preference (See VSCode settings under "HLedger")
Syntax Highlighting (details)
Rich syntax highlighting with hierarchical account coloring and project tags:
Aligns amounts to a configurable column position for clean, readable journal files:
Automatically sorts transactions chronologically:
Intelligent suggestions for both the standard categories and your own, and a suggestion for balancing amounts. For more info see AUTOCOMPLETE.md.
.journal.hledger.ledger
- Open a hledger journal file
- Use one of these methods to format:
- Press
Shift+Alt+Fto format the entire document - Save the file (if format on save is enabled)
- Right-click and select "Format hledger Journal" from the context menu
- Press
- Additional commands:
- Press
Shift+Cmd+Sto sort entries by date - Press
Cmd+/to toggle comments on selected lines - Press
Cmd+Nto create a new monthly journal file
- Press
This extension contributes the following settings:
hledger-formatter.formatOnSave: Enable/disable formatting on save (default: false)hledger-formatter.sortOnSave: Enable/disable sorting entries by date on save (default: false)hledger-formatter.amountColumnPosition: Column position for aligning amounts when using fixed column mode (default: 42, range: 20-100)hledger-formatter.amountAlignment: Choose between a fixed column or per-transaction widest alignment (default: widest)hledger-formatter.indentationWidth: Posting indentation width in spaces (default: 4)hledger-formatter.negativeCommodityStyle: Render negatives as-$or$-(default:$-)hledger-formatter.dateFormat: Preferred transaction date layout (YYYY-MM-DD,YYYY/MM/DD,YYYY.MM.DD)hledger-formatter.commentCharacter: Default character used when toggling comments (;,#, or*; default:;)
hledger-formatter.suggestBalancingAmounts: Enable/disable inline ghost text suggestions for balancing amounts (default: true)hledger-formatter.defaultAccountCategories: Include standard account categories in autocomplete (options: none, lowercase, uppercase, capitalize; default: lowercase)
Before formatting:
2023-01-05 Grocery Store
expenses:food $85.50
assets:bank:checking $-85.50
2023-01-10 Coffee Shop
expenses:dining:coffee $4.75
assets:cash $-4.75
After formatting:
2023-01-05 Grocery Store
expenses:food $85.50
assets:bank:checking -$85.50
2023-01-10 Coffee Shop
expenses:dining:coffee $4.75
assets:cash -$4.75
See CHANGELOG.md for a full list of changes in each release.
- VS Code 1.92.0 or newer
This is an open source project and contributions are welcome! See CONTRIBUTING.md for detailed information on:
- Setting up your development environment
- Running tests and building the extension
- Submitting pull requests
Feel free to:
- Report bugs or request features via GitHub Issues
- Submit pull requests with improvements
- Share feedback and suggestions
In addition to the VSCode Marketplace, this package is also available on the OpenVSX Registry: iiatlas/hledger-formatter.
For help and support, see SUPPORT.md
- Issues & Bug Reports: GitHub Issues
- Source Code: GitHub Repository
- VS Code Marketplace: hledger-formatter
MIT - see the LICENSE file for details




