Is there a Vim command to delete all fold markers in a file?
vim
Solution
tl;dr `zE` is the command you are looking for.
Now for the long version.
Assuming:
- Your `foldmethod` is set to `marker`.
- Your `foldmarker` setting matches the fold markers in the file (in your case it's the default `{{{,}}}`).
- Your `commentstring` is set properly (this is almost certainly the case, unless vIM doesn't have a syntax file for the file type).
You can just use `zE` which Eliminates all folds in the file.
You can check the settings by running `:set foldmethod? foldmarker? commentstring?` and set them by running `:set foldmethod=manual foldmarker={{{,}}} commentstring=#%s`.
See the docs here: http://vimdoc.sourceforge.net/htmldoc/fold.html#zE
There are some caveats in the docs here: http://vimdoc.sourceforge.net/htmldoc/fold.html#fold-delete-marker
This does not work properly when:
A line contains more than one marker and one of them specifies a level. Only the first one is removed, without checking if this will have the desired effect of deleting the fold.
The marker contains a level number and is used to start or end several folds at the same time.
Problem
To delete a particular fold one can do `zd`. To delete all fold markers one can execute: ``` :%s/# {{{// :%s/# }}}// ``` But is there a command (like `zd`) to delete all markers?