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

cjxgm (Vim Github Repository) <[email protected]> Tue, 11 Aug 2026 09:35:51 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/issues/21000/[email protected]>
cjxgm left a comment (vim/vim#21000)

> I am not sure if we change this behaviour it may annoy users.

So maybe a new option is required?

But, it's just a surprise seeing some lines unexpectedly folds when you set a foldexpr (and the folds expands to a single line, because of set nowrap), leaving you wonder whether you have a buggy foldexpr. It took me quite a while to realize it was related to line-wrapping.

> Since you cannot have wrapped and non-wrapped lines at the same time, why not set foldminlines to a really high number if you are using non-wrapped lines?

Because that would make legitimate foldable lines non-foldable. For example:

```vimscript
set nowrap
set foldmethod=expr
set foldexpr=getline(v:lnum)=~'^\\s'?1:0
set foldminlines=99
```

With these settings, I'd expect indented lines can be folded by `zc`, and long lines cannot be folded by `zc`.
But these settings actually make all lines non-foldable.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/issues/21000#issuecomment-5255985624
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/issues/21000/[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/21000/5255985624%40github.com.