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:
My _vimrc file only has this:
syntax on
set foldmethod=syntax
What can I do to fix it?
Syntax automatically folded
8.2.2825
Windows 10
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
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.![]()
@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.![]()
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.![]()
@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.![]()
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.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
please show this after loading an
abaqusbuffer
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.![]()
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.![]()
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.![]()
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
_vimrcfile: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.![]()
Closed #13874 as not planned.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
@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.![]()
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.![]()