Reputation: 77
I'm trying to enable vim indent folding.
From what I can see online, setting :set fdm=indent
should just work. For me, it doesn't do anything. I can fold manually, but I'm quite strict about indenting code, so indent-folding is ideal. I use spaces to indent (two spaces per level)
My ~/.vimrc looks like this:
set foldmethod=indent
and is definitely being loaded (according to :scriptnames
)
Is vim folding in some way dependent on the file type? I'm writing C CUDA, so the extension is .cu. Do I have to install some sort of plugin for indent folding? I know it's a broad question, but this seems like basic functionality and I have no idea why it's not working.
Upvotes: 2
Views: 2332
Reputation: 908
Another register I found that needs to be looked at if the fold behavior is "ignoring" what is clearly indented: make sure foldminlines
is set to 1 to generate all the folds you might expect.
This, in addition to the shiftwidth
setting to something like 2, or even 1 to generate a new fold level with every single space difference.
- E
Upvotes: 0
Reputation: 3638
set nofoldenable
turns off folding, it should be set foldenable
to enable it
Also set foldlevel=2
sets how many levels of the identified folds should be visible. If you want to specify the depth of indent to use for folding, the setting to use is shiftwidth
(e.g., set shiftwidth=2
)
Upvotes: 6