-
I have attempted to configure the Snippet of the approximate structure in Lua configuration: require("neorg").setup({
load = {
[ "core.concealer" ] = {
config = {
icons = {
ordered = {
level_<n> = {
icon = <some function>
}
}
}
}
}
}
}) (Other config options omitted for brevity.) The examples in the wiki do not work directly. For example, using I have attempted to use variations of: require("neorg.modules.core.concealer").public.concealing.ordered.enumerator.latin_lowercase() But without success. (Both with and without wrapping it in a So, could anyone guide me on how to customize the ordered list icons / symbols? I'm only looking to call the built-in functions. Not to change the icons completely. I don't want to use the uppercase or parentheses variations, only the Semi-related but off-topic: there is also a typo here. I think that should be "uppercase", not "uppwercase". |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is a somewhat annoying thing to solve because you have to know
You're getting that specific error because See this example for how to get this set up and the comments to help you build your mental model of what is happening Click on me to unfold minimal_neorg_with_ordered_mod.lualocal lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- require() depends on your runtimepath (rtp)
-- most of the time you get to ignore rtp because lazy.nvim
-- manages it for you. But it should be clear that in the opts
-- block being passed to lazy, lazy hasn't run yet so it can't
-- have setup the rtp
-- In theory you could do
vim.opt.rtp:append(",~/.local/share/nvim/lazy/neorg")
-- and then
-- require('neorg.modules.core.concealer.module)
-- but this won't work because the module depends on things
-- provided in neorg itself. The solution is to use the lazy
-- config block for neorg to require('neorg').setup(opts) and
-- then modify the module configuration after
require('lazy').setup({
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
opts = {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = { config = { icons = { ordered = {
-- icon = fn(int):string
-- (icon wants a fn that takes an int and returns a string)
-- here we pass the native lua function tostring()
level_1 = { icon = tostring }, -- easy!
-- custom functions are also easy:
level_2 = { icon = function(count)
local chars = { "q", "w", "e", "r", "t", "y" }
return chars[count] or "~"
end },
-- the wiki has
-- level_2.icon = module.public.concealing.ordered.enumerator.latin_uppercase
-- because the wiki is generated from the source code, which of
-- course can access a local function.
level_3 = {
-- this would fail because even through it loads the right path,
-- it depends on other things that aren't loaded when you
-- are generating this spec for lazy
--
-- so I've commented it out:
-- icon = require('neorg.modules.core.concealer.module').public.concealing.ordered.enumerator.latin_uppercase
},
} } } },
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
},
},
},
},
},
config = function(_,opts)
local neorg = require("neorg")
neorg.setup(opts)
-- get the concealer config table.
-- Tables are passed by reference in Lua
local ordered = neorg.modules.get_module_config("core.concealer").icons.ordered
-- now neorg is loaded so you can require() the concealer modules
ordered.level_3.icon = require("neorg.modules.core.concealer.module").public.concealing.ordered.enumerator.roman_lowercase
-- but this is dependendent on the filestructure of modules
-- which could change, so use the API instead
-- awkwardly, uppwercase (with a w) is correct right now until the code changes
ordered.level_4.icon = neorg.modules.get_module("core.concealer").concealing.ordered.enumerator.roman_uppwercase
end,
dependencies = {
{ "nvim-lua/plenary.nvim", },
{
-- YOU ALMOST CERTAINLY WANT A MORE ROBUST nvim-treesitter SETUP
-- see https://github.com/nvim-treesitter/nvim-treesitter
"nvim-treesitter/nvim-treesitter",
opts = {
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
},
config = function(_,opts)
require('nvim-treesitter.configs').setup(opts)
end
},
{ "folke/tokyonight.nvim", config=function(_,_) vim.cmd.colorscheme "tokyonight-storm" end,},
},
},
}) Just a fan of the project, not a dev. Hope this helps! |
Beta Was this translation helpful? Give feedback.
This is a somewhat annoying thing to solve because you have to know
require
path and pass by reference semantics on tables)You're getting that specific error because
runtimepath
isn't set up yet, but it wouldn't have worked anyways because loadingcore.concealer
relies onneorg
functionality. So even if neovim could find what you want, it would error out differ…