nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.26k stars 210 forks source link

Automatic folding #1302

Open fadri14 opened 6 months ago

fadri14 commented 6 months ago

Prerequisites

Neovim Version

v0.9.5

Neorg setup

neorg.setup{ load = { ["core.clipboard.code-blocks"] = {}, ["core.esupports.hop"] = {}, ["core.esupports.indent"] = {}, ["core.esupports.metagen"] = {}, ["core.itero"] = {}, ["core.journal"] = {}, ["core.keybinds"] = { config = { default_keybinds = false, --neorg_leader = "", --hook = function(keybinds) -- keybinds.map("norg", "n", "c", ":Neorg keybind all core.looking-glass.magnify-code-block") --end, }, }, ["core.looking-glass"] = {}, ["core.pivot"] = {}, ["core.promo"] = {}, ["core.qol.toc"] = {}, ["core.qol.todo_items"] = {}, ["core.tangle"] = {}, ["core.upgrade"] = {}, ["core.concealer"] = {}, ["core.dirman"] = { config = { workspaces = { notes = "~/Notes", }, }, }, }, }

Actual behavior

As soon as I open a file, whether it's an org file or something else, it's totally folded.

Expected behavior

I would like everything to be unfolded as soon as the file is opened.

Steps to reproduce

Open any file

Potentially conflicting plugins

No response

Other information

I know that folding is a basic feature of neovim but I had never experienced this behavior before installing and configuring neorg. 2024-02-10T17:26:49,264112605+01:00

Help

None

Implementation help

No response

pysan3 commented 6 months ago

Change foldlevel or foldlevelstart option in vim.

fadri14 commented 6 months ago

I had not configured these parameters. I just did it with the following values and I have a strange behavior.

foldlevel = 0
foldlevelstart = -1

Now, I only have the problem with neorg files knowing that I'm going through the alpha plugin, if I open the file directly, I don't have the problem. I'd like to point out that if I delete the neorg loading, I no longer have any problems. I don't really understand what's going on.

pysan3 commented 6 months ago

If you want to set vim options, you will have to do something like set foldlevel=0 and in lua vim.opt.foldlevel = 0. I don't see either so I don't understand what you are trying to do.

Besides, did you read the help files? You should set foldlevel to a high number if you don't want to have any folds (e.g. 99), and please read :h foldlevelstart as that should answer your question.

fadri14 commented 6 months ago

My settings are fine. After several tests, I notice that the elements are all folded only if it's a neorg file and I open it with telescope.

fadri14 commented 6 months ago

OK. I didn't have all the documentation yet. It's from the core.concealer plugin.

Whalee110 commented 5 months ago

I have a similar issue, all the commands / settings are correct it's just when I open a norg file using telescope. Were you able to find a solution or did you just remove concealer?

pillzu commented 3 months ago

Literally running into this issue right now. Somehow the foldmethod changes from manual to expression for all files in that specific session.

From what I understand, the issue originates from the core.concealer, specifically when it sets vim.wo[event.window].foldmethod=expr, which sets it for the entire workspace. I'll see if I can push a fix by replacing the workspace based modifications with a buffer based modification (tho I am not sure if that would solve it in it's entirety, it makes a lot of sense rn lol)

EDIT: Okay! I was wrong lol. The vim.wo[event.window] only sets for that window. Not sure why it's staying consistent to other files as well.