SmiteshP / nvim-navbuddy

A simple popup display that provides breadcrumbs feature using LSP server
Apache License 2.0
770 stars 30 forks source link

Foldmethod auto set manual #49

Open KaminoU opened 1 year ago

KaminoU commented 1 year ago

• foldmethod auto set to manual • avoid dup folding • add/clean leading spaces before the fold marker comment string

SmiteshP commented 1 year ago

• foldmethod auto set to manual

I don't want to do this, foldmethod = manual is the default setting of neovim. And if foldmethod is set to something else, that means the user did that himself/herself. Navbuddy shouldn't just override it.

• add/clean leading spaces before the fold marker comment string

I also don't want to make changes to text while folding text. It might be surprise to the user to see spaces getting removed.

• avoid dup folding

This is ok 👍🏽

KaminoU commented 1 year ago

• foldmethod auto set to manual

I don't want to do this, foldmethod = manual is the default setting of neovim. And if foldmethod is set to something else, that means the user did that himself/herself. Navbuddy shouldn't just override it.

I dont understand. The foldmethod is only an option to let nvim to know how to fold blocks.

In our case, I see Navbuddy as a tool that help us to quickly mark things to fold... And we only toggle this option to manual mode during a short time to write the fold marker comment string

That's what I do understand and that's why I do like Navbuddy, to help us to do quickly things, like the "which-key" plugin

Moreover, as we let the user to choose with options in navbuddy...

• add/clean leading spaces before the fold marker comment string

I also don't want to make changes to text while folding text. It might be surprise to the user to see spaces getting removed.

Would you mind to give a try please ? I do not break the code. On python for example, without leadings space, the linter raises ugly error/warnng messages. By writing this, it makes me realise that there is one case that I did not catch...

image

• avoid dup folding

This is ok 👍🏽

For the indentation/style sorry for this, it's the auto format when saving file ; no any intention to hurt your sensibility 😜

In any case thank you for your reply

KaminoU commented 1 year ago

I have modified my approach by simplifying the instructions to fit your requirements.

As said, to me, the main purpose of navbuddy is to accompany the users, and the capacity of marking dynamically fold comment string is a great feature.

I hope that this new version will better fit your initial idea of navbuddy.

I do not break any codes, I just give to the user the choice of doing thing dynamically if they want. And after the fold action, we restore the initial option

Cheers

SmiteshP commented 1 year ago

In our case, I see Navbuddy as a tool that help us to quickly mark things to fold... And we only toggle this option to manual mode during a short time to write the fold marker comment string

Oh ok. I was under the impression that changing fold method (even temporarily) would mess up folds created with different methods. But if it preserves other folds properly, then we have have this quick toggle as default anyways.

Would you mind to give a try please ? I do not break the code. On python for example, without leadings space, the linter raises ugly error/warning messages.

I am not against this feature, but I don't want this to be mixed with fold action. this could be its own action, something like format code or something action.

KaminoU commented 1 year ago

I am not against this feature, but I don't want this to be mixed with fold action. this could be its own action, something like format code or something action.

Hello,

I agree with you on this point. But... there is a lil but 😝

If we opt for the auto format stuff, it will format all the file... (that's what I did and you yelled on me earlier 😆)

In our case, we do things properly, we only change the fold marker comment string.

I invite you to give a try, with Packer it's easy, just add a branch and then you can delete it later, I believe that it will more relevant to see thing by yourself.

As said, I do not break anything ; I like flexibility and it gives a great opportunity to the user.

I have a personnal use case, I often read code and to know that I can fold/unfold quickly some portion of code is really a great feature. That's why I was glad to find Navbuddy

Cheers

P.S. I should rename reinit_foldmethod to restore_foldmethod (more relevant...)

local reinit_foldmethod = function()
    vim.o.foldmethod = USER_FOLDMETHOD
end
SmiteshP commented 1 year ago

If we opt for the auto format stuff, it will format all the file... (that's what I did and you yelled on me earlier 😆)

Thats not what I meant 😅

In our case, we do things properly, we only change the fold marker comment string. I invite you to give a try, with Packer it's easy, just add a branch and then you can delete it later, I believe that it will more relevant to see thing by yourself.

I am not sure what you mean by "only changing the fold marker comment string". 🤔 Yep, I will try it out.