Reputation: 8021
I try to fold on Python functions, not on indent. Is there a build in method or Regex-rule I can use? (Solved further down)
This is my code so far:
set foldmethod=indent
nnoremap <space> za
vnoremap <space> zf
Two last lines is for open/closing with Space.
The top/black-version is what I try to accomplish. Overlapping terminal is my version (+styling) (From Fast.ai - Lesson 3: Deep Learning 2018)
Complete with styling:
set foldmethod=indent
nnoremap <space> za
vnoremap <space> zf
syntax on
colorscheme desert
(How to change the global-config in Vim: 'cd ~' and 'vim .vimrc')
Solution from python-mode:
cd ~/.vim/pack/foo/start
git clone https://github.com/python-mode/python-mode.git
cd python-mode
git submodule update --init --recursive
And this line in ~/.vimrc to enable closing with space
nnoremap <space> za
Could be that you have to create all the folders in ~/.vim/pack/foo/start
Upvotes: 1
Views: 2354
Reputation: 7981
The excellent python-mode plug-in folds on its own, more advanced expression, by default. It produces the results in your screenshot.
Upvotes: 2