Skip to content

Configuration

rustledger can be configured via environment variables, config files, and command-line options.

Environment Variables

VariableDescriptionExample
RLEDGER_FILEDefault beancount file~/ledger.beancount
RLEDGER_PROFILEActive profile namebusiness
NO_COLORDisable colored output1

Set in your shell profile (~/.bashrc, ~/.zshrc):

bash
export RLEDGER_FILE="$HOME/finances/main.beancount"

Config File

rustledger looks for configuration in these locations (highest to lowest priority):

  1. .rledger.toml in the current directory (searching upward)
  2. ~/.config/rledger/config.toml (user config)
  3. /etc/rledger/config.toml (system config, Unix only)

Higher priority configs override lower ones. You can also generate a default config with:

bash
rledger config init           # Create user config
rledger config init --project # Create project config (.rledger.toml)
rledger config edit           # Open config in editor
rledger config show           # Show merged configuration

Example Config

toml
# ~/.config/rledger/config.toml

[default]
# Default beancount file
file = "~/finances/main.beancount"

# Editor for interactive commands (defaults to $EDITOR)
# editor = "nvim"

# Command-specific output settings
[commands.query.output]
format = "text"

[commands.report.output]
format = "text"

# Profiles for different ledgers
[profiles.personal]
file = "~/finances/personal.beancount"

[profiles.business]
file = "~/finances/business.beancount"

# Command aliases
[aliases]
bal = "report balances"
is = "report income"
bs = "report balsheet"

Using Profiles

bash
# Use a profile
rledger check -P personal
rledger report balances -P business

# Override ledger file
rledger check ~/other/ledger.beancount

Beancount Options

Set options in your beancount file:

beancount
option "title" "My Personal Finances"
option "operating_currency" "USD"
option "booking_method" "FIFO"

Common Options

OptionDescriptionDefault
titleLedger title(none)
operating_currencyMain currency(none)
booking_methodFIFO, LIFO, AVERAGE, etc.STRICT
account_previous_balancesRetained earnings accountEquity:Opening-Balances
account_current_earningsCurrent earnings accountEquity:Earnings:Current
inferred_tolerance_defaultBalance tolerance0.005

Booking Methods

beancount
; First-in, first-out
option "booking_method" "FIFO"

; Last-in, first-out
option "booking_method" "LIFO"

; Average cost
option "booking_method" "AVERAGE"

; Strict matching (default)
option "booking_method" "STRICT"

Shell Aliases

For quick commands, add aliases to your shell:

bash
# ~/.bashrc or ~/.zshrc

export RLEDGER_FILE="$HOME/finances/main.beancount"

# Quick commands
alias rc='rledger check'
alias rq='rledger query'
alias rb='rledger report balances -a'
alias rr='rledger report journal -a'
alias rbal='rledger report balsheet'
alias ris='rledger report income'

# Usage:
# rc                    - check ledger
# rb Expenses:Food      - balance for food expenses
# rr Assets:Bank        - register for bank accounts

Editor Integration

VS Code

Install the Beancount extension and configure it to use rustledger:

json
{
  "beancount.lspPath": "rledger-lsp"
}

Neovim

Using nvim-lspconfig:

lua
require('lspconfig').rledger_lsp.setup{}

Helix

Add to ~/.config/helix/languages.toml:

toml
[[language]]
name = "beancount"
language-server = { command = "rledger-lsp" }

See Editor Integration for detailed setup instructions.

Next Steps