Skip to content

Instantly share code, notes, and snippets.

@sidkang
Created January 29, 2023 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidkang/0a83866e79e5b519dd812afb4a20bed7 to your computer and use it in GitHub Desktop.
Save sidkang/0a83866e79e5b519dd812afb4a20bed7 to your computer and use it in GitHub Desktop.
Neovim Beancount Basic Config
-- after/ftplugin/beancount.lua
vim.opt.wrap = false
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.g.beancount_separator_col = 55
vim.g.beancount_root = vim.trim(vim.fn.system('pwd')) .. "/" .. "main.bean"
-- for omni func
vim.keymap.set("i", "\"", "\"<C-x><C-o>", { silent = true })
vim.keymap.set("i", ".", ".<C-\\><C-O>:AlignCommodity<CR>", { silent = true })
vim.keymap.set("i", "<C-n>", "<C-x><C-o>", { silent = true })
vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave" }, {
callback = function()
vim.cmd([[ :%AlignCommodity ]])
end,
})
local beancount_ignore_patterns = {
"CNY",
"USD",
}
cmp.setup.filetype("beancount", {
sources = {
{
name = "buffer",
entry_filter = function(entry, ctx)
return not vim.tbl_contains(beancount_ignore_patterns, entry:get_word())
end
},
{
name = "beancount",
option = {
account = vim.trim(vim.fn.system('pwd')) .. "/main.bean"
},
}
},
experimental = {
ghost_text = true,
native_menu = false,
},
})
npairs.setup {
...
disable_filetype = { "TelescopePrompt", "beancount" },
...
}
@sidkang
Copy link
Author

sidkang commented Jan 29, 2023

Most needed plugins

general
“hrsh7th/nvim-cmp”
"nvim-treesitter/nvim-treesitter"

beancount
"crispgm/cmp-beancount"
"nathangrigg/vim-beancount"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment