You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to search the manual and Github for tools that automatically format ledger files (similar to Black for Python or gofmt for Go). I write my ledger file in vim and it ends up with inconsistent formatting, especially between the account and amount which vary for each transaction.
Does a command to format files already exist? If not, how difficult would it be to write?
The text was updated successfully, but these errors were encountered:
In the PTA world, only the PTA tools themselves can fully parse their own formats, and they usually have a command for outputting the same format (like print). But none of them does this perfectly, eg hledger print is good at preserving everything within a transaction, but it doesn't preserve directives or inter-transaction comments, so you have to work around that.
There are some editor/IDE addons which can parse and reformat PTA data files. These parse more superficially, and are less strict with their formatting, but they are probably better at preserving data. ledger-mode in Emacs (M-q key), VS Code extensions like hledger-vscode, ledger, and Beancount, and probably some vim addons are some of these.
I can't reproduce your example, but the current general behaviour of hledger print is: it right-aligns the amounts, separately within each transaction. It doesn't align them across all transactions; ledger-mode is good for that.
I've tried to search the manual and Github for tools that automatically format ledger files (similar to Black for Python or gofmt for Go). I write my ledger file in vim and it ends up with inconsistent formatting, especially between the account and amount which vary for each transaction.
Does a command to format files already exist? If not, how difficult would it be to write?
The text was updated successfully, but these errors were encountered: