[vim/vim] long lines automatically become foldable even with set nowrap (Issue #21000)

6 views
Skip to first unread message

cjxgm

unread,
Aug 10, 2026, 5:14:24 PM (18 hours ago) Aug 10
to vim/vim, Subscribed
cjxgm created an issue (vim/vim#21000)

Steps to reproduce

Type some text, with some lines extremely long, beyond the screen.

set nowrap
set foldmethod=expr
set foldexpr='>1'

You should see some lines are folded, and each of those folded lines can unfold to a single line. If not, fold all by zM

Expected behaviour

No lines become foldable.

I can see why they are foldable. If you set wrap, long lines wrap to multiple lines, so they becoming foldable is reasonable. But with set nowrap, it makes no sense to make long lines foldable, as you will be folding single line into single line.

Version of Vim

9.2 (2026 Feb 14) included patches 1-849

Environment

Arch Linux

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21000@github.com>

Christian Brabandt

unread,
2:18 AM (9 hours ago) 2:18 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21000)

This behaviour is controlled by the 'foldminlines' option. I can see that it might be unintuitive for non-wrapped lines however.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21000/5249689337@github.com>

cjxgm

unread,
7:30 AM (4 hours ago) 7:30 AM
to vim/vim, Subscribed
cjxgm left a comment (vim/vim#21000)

This behaviour is controlled by the 'foldminlines' option. I can see that it might be unintuitive for non-wrapped lines however.

'foldminlines' also changes how other folds behave. E.g. you have a foldexpr control the folding behavior, and then non-wrapped long lines become foldable regardless of foldexpr results. Setting 'foldminlines' affects both the foldexpr-specified folds and non-wrapped-long-line folds.

And, there is no single value to set 'foldminlines' to that can achieve desired behavior. When resizing the window, the same line may wrap to 3, 4, or more screen lines depending on the window width, and 'foldminlines' will consult the number of wrapped lines, even if we set nowrap.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21000/5252538745@github.com>

cjxgm

unread,
7:46 AM (4 hours ago) 7:46 AM
to vim/vim, Subscribed
cjxgm left a comment (vim/vim#21000)

It would be great (though this would be a feature request) if we have an option, that can disable wrapped lines becoming foldable automatically even with set wrap. Now that we are specifying folds manually by foldexpr, I would expect we can have the option to disable all the "baked-in mechanisms" of internal folds.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21000/5252716297@github.com>

Reply all
Reply to author
Forward
0 new messages