How to make Python stack in vim rather than visually break spaces?

When I dump Python code in vim, the fold text always starts from scratch. This is visually noisy since Python has significant gaps - it looks like top-level code when I view the file.

Is there a parameter to tell the word foldtext to fall back to the level of the first line of the folded code without overwriting the foldtext () method?

+6
source share
1 answer

The way to influence this is with the help of the 'foldtext' option.

Here is a simple example to get you started:

 :setlocal foldtext=repeat('\ ',indent(v:foldstart)).foldtext() 
+1
source

All Articles