You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like this project. Just moved away from simpylfold.
BACKGROUND
I was wondering if something like customization was possible using vim-anyfold. Please have a look at the two pictures attached to this message. The first screenshot shows the editor without folds:
You see four "blocks" of code all preceded with a characteristic form of comment (three hashes in a row and the comment text restricted to the 2nd row, at least for Python code). This specific format is intended to be different from the "normal" line comments, as they kind of are on a different level and relate rather to a block than to a line of code or the inner program structures (for, if,...). Now, I would like to always keep these "block comments" visible, regardless on which indentation level they are written. Folds of this type should start with one of these block comments and end just before the next block comment (or the end of the file / function / ... ). See the next picture for clarification of the outcome:
This modified screenshot shows the editor scope after applying the fold method on the specifically designed block comments. So, the developer can concentrate on the block comments alone and is free to step into deeper levels of the code as he wishes.
QUESTION
Is there something like a mechanism to specify a language-specific regular expression statement (e.g. ^[\s]*#[\s]*[\r\n]+[\s]*#[\s]*[a-zA-z0-9]+[\s]*[\r\n]+[\s]*#) matching the very specific form of a block comment? So that folds can be realized between these block comments?
HINTS
If there is nothing like this possible at the moment, I would be glad for any developer who could give me some hints where to start implementing this feature myself. I hope, this would be possible starting off with the current code base.
Any Ideas?
Thanks.
Nnako
The text was updated successfully, but these errors were encountered:
I'm glad that you like this project - there is not yet a customization mechanism, but I agree this would be a highly useful feature. Do you want to combine the folds defined by this plugin with your custom folds or do you want to completely override the default folds? Overriding the default folds would be certainly easier and I assume for the moment that this is what you want.
You can implement custom folds by replacing this function. This function is used to store in a list b:anyfold_ind_actual the actual indents for each line. Your new alternative function should increase the list value when a line is encountered that defines a new block (and otherwise reuse the value of the previous line).
For debugging, use let g:anyfold_debug = 1, then you can use F8 to inspect the value of b:anyfold_ind_actual for a specific line.
Hi,
I like this project. Just moved away from simpylfold.
BACKGROUND
I was wondering if something like customization was possible using vim-anyfold. Please have a look at the two pictures attached to this message. The first screenshot shows the editor without folds:
You see four "blocks" of code all preceded with a characteristic form of comment (three hashes in a row and the comment text restricted to the 2nd row, at least for Python code). This specific format is intended to be different from the "normal" line comments, as they kind of are on a different level and relate rather to a
block
than to aline
of code or the inner program structures (for, if,...). Now, I would like to always keep these "block comments" visible, regardless on which indentation level they are written. Folds of this type should start with one of these block comments and end just before the next block comment (or the end of the file / function / ... ). See the next picture for clarification of the outcome:This modified screenshot shows the editor scope after applying the fold method on the specifically designed block comments. So, the developer can concentrate on the block comments alone and is free to step into deeper levels of the code as he wishes.
QUESTION
Is there something like a mechanism to specify a language-specific regular expression statement (e.g.
^[\s]*#[\s]*[\r\n]+[\s]*#[\s]*[a-zA-z0-9]+[\s]*[\r\n]+[\s]*#
) matching the very specific form of a block comment? So that folds can be realized between these block comments?HINTS
If there is nothing like this possible at the moment, I would be glad for any developer who could give me some hints where to start implementing this feature myself. I hope, this would be possible starting off with the current code base.
Any Ideas?
Thanks.
Nnako
The text was updated successfully, but these errors were encountered: