Open All Folds When Opening a File

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Open All Folds When Opening a File

goldhexter
Hello all,

I've used VIM for basic editing, but am new to using it as a full fledged development environment. Much of my coding is via Python so I've installed the SimpylFold plugin via Vundle. All is fine, I can unfold and fold using the "z" options. However, what I'd like to do is always have a python file unfolded completely upon initial opening (or even better would be to save state if that is possible). I.e. have VIM automatically execute a "zM" each time a file is opened.

Is there any straightforward way to do the above (am really a newbie at this at the moment).

Thanks,
Ter

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Open All Folds When Opening a File

Gary Johnson-4
On 2016-04-01, goldhexter wrote:

> Hello all,
>
> I've used VIM for basic editing, but am new to using it as a full
> fledged development environment. Much of my coding is via Python
> so I've installed the SimpylFold plugin via Vundle. All is fine, I
> can unfold and fold using the "z" options. However, what I'd like
> to do is always have a python file unfolded completely upon
> initial opening (or even better would be to save state if that is
> possible). I.e. have VIM automatically execute a "zM" each time a
> file is opened.
>
> Is there any straightforward way to do the above (am really a
> newbie at this at the moment).

To always start editing with all folds open, put this in your
~/.vimrc:

    set foldlevelstart=99

See

    :help 'foldlevelstart'
    :help fold-foldlevel

If you want to open only Python files will all folds open, put this
in a file with the path name ~/.vim/after/ftplugin/python.vim:

    set foldlevel=99

See

    :help 'foldlevel'
    :help 28.5

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Open All Folds When Opening a File

Charles Campbell
In reply to this post by goldhexter
goldhexter wrote:
> Hello all,
>
> I've used VIM for basic editing, but am new to using it as a full fledged development environment. Much of my coding is via Python so I've installed the SimpylFold plugin via Vundle. All is fine, I can unfold and fold using the "z" options. However, what I'd like to do is always have a python file unfolded completely upon initial opening (or even better would be to save state if that is possible). I.e. have VIM automatically execute a "zM" each time a file is opened.
>
> Is there any straightforward way to do the above (am really a newbie at this at the moment).
>
* you want to use zR to open all folds
* you want to have something happen just to python files, so therefore:
make a file called  .../.vim/ftplugin/python.vim .  This file will be
sourced whenever one opens a python file.
* Place   norm! zR  in the .vim/ftplugin/python.vim file.  This will run
zR as a normal command (as opposed to a command-line one).

HTH,
Chip Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.