nomodeline optionI was moving my .profile config to a new ZVDT recently.
# vim:fileencoding=utf-8:foldmethod=marker
export HISTSIZE=99999
export TERMINFO="$HOME/.terminfo"
# {{{ : zopen tools
.  "$ZOT/etc/zopen-config" --nooverride-zos-tools
# }}}And when I opened it in neovim I was got that it did not fold the zopen tools section. Trying zM did not collapse it either. And moving cursor on the zopen line and trying zc did not work either.
Checking option :set foldmethod? reveled “foldmethod=manual”. This turned out to be because of nomodeline option.
Why did I have nomodeline? I checked the setup on both old and new machine and consistently I had modelineon the old machine and nomodeline on the new one. Same version of neovim, same configs, same environment variables. :mind-exploding:.
To learn why, see TLDR.
vimscript
:set modeline?  " check current the value of 'modeline'
:set modeline   " set 'modeline' to true
:set nomodeline " set 'modeline' to false
:set modeline&. " set 'modeline' to its default value
:echo nvim_get_option_info2("modeline",{}).default   " check the default value of 'modeline'lua
:lua vim.opt.modeline = true
:lua vim.opt.modeline = false
:lua print(vim.opt.modeline:get()):h scriptnames
nvim -u NONE -i NONE
nvim --clean
nvim -u NONE
nvim -u NORC
nvim --noplugin`:set! all ” the exclamation mark makes every option to go to its own line
`:set! ” the exclamation mark makes every option to go to its own line
:redir! > /tmp/nvim.opts`  " ! will override the file if it alraedy exits
:set!                      " ! will put every option on its own line
:redir END>>@{a-z}for more info see :h redir
-V1 option. This enables verbosity level 1.
nvim -V1set <option>?. For example
set modeline?This will
These steps work both for vim and lua scripts.
For more info see
:h :verbose-cmd
:h 'verbose'
:h :verbosenvim -V99/tmp/nvim.log
The ‘modeline’ option has a different defaults for regular users and for root. It is documented in the (neo)vim help:
:h 'modeline'                                'modeline' 'ml' 'nomodeline' 'noml'            
'modeline' 'ml'         boolean (default on (off for root))                    
                        local to buffer                                        
        If 'modeline' is on 'modelines' gives the number of lines that is      
        checked for set commands.  If 'modeline' is off or 'modelines' is zero 
        no lines are checked.  See modeline.                                   Notice the default value:
How is it determined that a user is a root? By checking whether its user id is 0.
On z/OS there is no root user per say but a special admin user can have a user id 0. To check your user id run:
# id
uid=0(OMVSKERN) ...Many thanks to clason and seandewar from the #neovim-dev channel on matrix for pointing me in the right direction after two days of despair.