commit 5ba375f8ae60e0909b8cfce9d14a288b91e32f6c
parent 55162b155fd46b56f8a280e9ed994458a875e301
Author: Chris Bracken <chris@bracken.jp>
Date: Thu, 14 Aug 2025 18:28:25 +0900
nvim: better beancount support
* Formats beancount files on save using bean-format
* Configures beancount-language-server
Diffstat:
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/.config/nvim/after/ftplugin/beancount.lua b/.config/nvim/after/ftplugin/beancount.lua
@@ -0,0 +1,5 @@
+vim.api.nvim_create_autocmd("BufWritePost", {
+ pattern = "*.beancount",
+ command = "silent !bean-format % -o %",
+ desc = "Run bean-format on save",
+})
diff --git a/.config/nvim/lua/plugins/languages.lua b/.config/nvim/lua/plugins/languages.lua
@@ -76,6 +76,15 @@ return {
if vim.fn.executable('rust-analyzer') == 1 then
lspconfig.rust_analyzer.setup({})
end
+ if vim.fn.executable('beancount-lsp') == 1 then
+ lspconfig.beancount.setup({
+ init_options = {
+ journal_file = (function()
+ return vim.fn.findfile('main.beancount', '.')
+ end)(),
+ },
+ })
+ end
if vim.fn.executable('sourcekit-lsp') == 1 then
local cfg = create_sourcekit_cfg(sdk_map.iOS)
lspconfig.sourcekit.setup(cfg)