[vim/vim] Syntax-based folding in gVim doesn't work on some Windows machines (Issue #13874)

29 views
Skip to first unread message

FEA-eng

unread,
Jan 16, 2024, 1:42:15 PM1/16/24
to vim/vim, Subscribed

Steps to reproduce

Hi,
I have gVim installed on multiple computers with Windows 10. Automatic syntax folding works on most of them but it doesn't work on some. I need it to fold large portions of the code in .inp files. Syntax coloring works but not folding.

For example, lines under *Node should be folded automatically:

vim.JPG (view on web)

My _vimrc file only has this:

syntax on
set foldmethod=syntax

What can I do to fix it?

Expected behaviour

Syntax automatically folded

Version of Vim

8.2.2825

Environment

Windows 10

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13874@github.com>

Christian Brabandt

unread,
Jan 17, 2024, 11:51:30 AM1/17/24
to vim/vim, Subscribed

syntax based folding doesn't work for all filetypes and may depend on what filetype you are working with. So please get us more information: What is the filetype when it works, and when it does not work? Have you checked the help at :h ft-<filetype>-syntax (sometimes you need to set specific options to make this work, this should be documented in the help for that particular filetype).

set foldmethod=syntax

Note: foldmethod is a buffer-local option, it usually does not make sense to set this in the .vimrc file like you did. It may be overridden by your filetype specific plugins.


Reply to this email directly, view it on GitHub.

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

FEA-eng

unread,
Jan 17, 2024, 2:08:38 PM1/17/24
to vim/vim, Subscribed

@chrisbra The filetype both when it works and when it doesn't work is abaqus (and it should be like this, also syntax highlighting works properly, only folding doesn't).

Should I type :h ft-abaqus-syntax ? It shows no results in both cases.

What else can I do to try to enable folding ? It's strange that it works on some machines and doesn't on other.


Reply to this email directly, view it on GitHub.

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

Christian Brabandt

unread,
Jan 17, 2024, 2:35:32 PM1/17/24
to vim/vim, Subscribed

The current abaqus syntax script included with Vim does not define syntax based folding. So you must have installed a plugin or similar. Check the output of :sriptnames for both instances.


Reply to this email directly, view it on GitHub.

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

FEA-eng

unread,
Jan 17, 2024, 2:58:36 PM1/17/24
to vim/vim, Subscribed

@chrisbra :scriptnames shows the following on the machine where it doesn't work:

  1: ~\_vimrc
  2: E:\Program Files (x86)\Vim\vim82\syntax\syntax.vim
  3: E:\Program Files (x86)\Vim\vim82\syntax\synload.vim
  4: E:\Program Files (x86)\Vim\vim82\syntax\syncolor.vim
  5: E:\Program Files (x86)\Vim\vim82\filetype.vim
  6: E:\Program Files (x86)\Vim\vim82\menu.vim
  7: E:\Program Files (x86)\Vim\vim82\autoload\paste.vim
  8: E:\Program Files (x86)\Vim\vim82\scripts.vim
  9: E:\Program Files (x86)\Vim\vim82\plugin\getscriptPlugin.vim
 10: E:\Program Files (x86)\Vim\vim82\plugin\gzip.vim
 11: E:\Program Files (x86)\Vim\vim82\plugin\logiPat.vim
 12: E:\Program Files (x86)\Vim\vim82\plugin\manpager.vim
 13: E:\Program Files (x86)\Vim\vim82\plugin\matchparen.vim
 14: E:\Program Files (x86)\Vim\vim82\plugin\netrwPlugin.vim
 15: E:\Program Files (x86)\Vim\vim82\plugin\rrhelper.vim
 16: E:\Program Files (x86)\Vim\vim82\plugin\spellfile.vim
 17: E:\Program Files (x86)\Vim\vim82\plugin\tarPlugin.vim
 18: E:\Program Files (x86)\Vim\vim82\plugin\tohtml.vim
 19: E:\Program Files (x86)\Vim\vim82\plugin\vimballPlugin.vim
 20: E:\Program Files (x86)\Vim\vim82\plugin\zipPlugin.vim

and the following on the machine where it works:


Reply to this email directly, view it on GitHub.

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

Christian Brabandt

unread,
Jan 17, 2024, 3:28:28 PM1/17/24
to vim/vim, Subscribed

please show this after loading an abaqus buffer


Reply to this email directly, view it on GitHub.

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

Gary Johnson

unread,
Jan 17, 2024, 3:30:43 PM1/17/24
to reply+ACY5DGDK4RJRBSVCY6...@reply.github.com, vim...@googlegroups.com
On 2024-01-17, FEA-eng wrote:

Try this on the machines where syntax folding works and where it
doesn't while editing a file for which you expect it to work.

:verbose set foldmethod?

That should tell you where 'foldmethod' was last set and the value
it was set to.

Regards,
Gary

vim-dev ML

unread,
Jan 17, 2024, 3:31:04 PM1/17/24
to vim/vim, vim-dev ML, Your activity


Reply to this email directly, view it on GitHub.

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

FEA-eng

unread,
Jan 17, 2024, 3:51:21 PM1/17/24
to vim/vim, vim-dev ML, Comment

please show this after loading an abaqus buffer

Then both have syntax\abaqus.vim but only the one where it works has ftplugin\abaqus.vim

How can I install it ?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896666994@github.com>

FEA-eng

unread,
Jan 17, 2024, 3:54:04 PM1/17/24
to vim/vim, vim-dev ML, Comment

On 2024-01-17, FEA-eng wrote: Try this on the machines where syntax folding works and where it doesn't while editing a file for which you expect it to work. :verbose set foldmethod? That should tell you where 'foldmethod' was last set and the value it was set to. Regards, Gary

I get foldmethod=manual on the machine where it doesn't work and this on the machine where it works:

foldmethod=expr
Last set from E:\Program Files\Vim\vim90\ftplugin\abaqus.vim line 44

How can I get the same on the other machine ?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896670244@github.com>

Christian Brabandt

unread,
Jan 17, 2024, 4:09:52 PM1/17/24
to vim/vim, vim-dev ML, Comment

I get foldmethod=manual on the machine where it doesn't work and this on the machine where it works

Make sure you have filetype plugins enabled. Add a line like this to your _vimrc file:

filetype plugin indent on


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896716825@github.com>

FEA-eng

unread,
Jan 17, 2024, 4:11:57 PM1/17/24
to vim/vim, vim-dev ML, Comment

I get foldmethod=manual on the machine where it doesn't work and this on the machine where it works

Make sure you have filetype plugins enabled. Add a line like this to your _vimrc file:

filetype plugin indent on

It finally works after adding that line. Thank you very much.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896727811@github.com>

Christian Brabandt

unread,
Jan 17, 2024, 4:13:42 PM1/17/24
to vim/vim, vim-dev ML, Comment

Closed #13874 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issue/13874/issue_event/11516530743@github.com>

FEA-eng

unread,
Jan 17, 2024, 4:18:53 PM1/17/24
to vim/vim, vim-dev ML, Comment

@chrisbra Just one more question if you don't mind - when I unfold a line by pressing the left or right arrow key, can I quickly fold it back somehow ? I've never figured it out.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896765207@github.com>

Christian Brabandt

unread,
Jan 17, 2024, 4:24:46 PM1/17/24
to vim/vim, vim-dev ML, Comment

You may want to read up on folding in general: :h fold-commands and :h usr_28.txt for some light reading.

In your particular case you probably want the normal mode command zc.

Please ask user-questions at more appropriate questions (like vi.stackexchange.com, reddit or the vim-use mailinglist). We cannot support individual help here. Thanks for understanding.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/13874/1896798651@github.com>

Reply all
Reply to author
Forward
0 new messages