Quantcast

Behavior of fold when adding new fold

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Behavior of fold when adding new fold

Yichao Zhou
Hi, everyone.
  I use fdm=marker.  The problem is when you add a fold, the fold
after it will automatically open.

  For example, type {{{<CR>}}}<ESC>zcggO{{{

  You will find the second fold is opened automatically.  This is
annoying when editing.  Must I reclose all the folding when add a new
one?

Regards,
Yichao Zhou

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Behavior of fold when adding new fold

Christian Brabandt
Hi Yichao!

On So, 15 Apr 2012, Yichao Zhou wrote:

> Hi, everyone.
>   I use fdm=marker.  The problem is when you add a fold, the fold
> after it will automatically open.
>
>   For example, type {{{<CR>}}}<ESC>zcggO{{{
>
>   You will find the second fold is opened automatically.  This is
> annoying when editing.  Must I reclose all the folding when add a new
> one?

Have you checked your 'foldlevel' setting?

regards,
Christian

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Behavior of fold when adding new fold

Marcin Szamotulski
In reply to this post by Yichao Zhou
On 15:32 Sun 15 Apr     , Yichao Zhou wrote:

> Hi, everyone.
>   I use fdm=marker.  The problem is when you add a fold, the fold
> after it will automatically open.
>
>   For example, type {{{<CR>}}}<ESC>zcggO{{{
>
>   You will find the second fold is opened automatically.  This is
> annoying when editing.  Must I reclose all the folding when add a new
> one?
>
> Regards,
> Yichao Zhou
>
> --
> 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

The tip is to first put closing marker }}} and then the opening one {{{.
You can also use {{{1 (without adding closing marker, the next {{{1 serves as
opening and closing marker)

Best,
Marcin

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Behavior of fold when adding new fold

Yichao Zhou
Unfortunately, "{{{1" has the same problem.

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Behavior of fold when adding new fold

Ben Fritz
In reply to this post by Yichao Zhou
On Sunday, April 15, 2012 2:32:09 AM UTC-5, Yichao Zhou wrote:

> Hi, everyone.
>   I use fdm=marker.  The problem is when you add a fold, the fold
> after it will automatically open.
>
>   For example, type {{{<CR>}}}<ESC>zcggO{{{
>
>   You will find the second fold is opened automatically.  This is
> annoying when editing.  Must I reclose all the folding when add a new
> one?
>
> Regards,
> Yichao Zhou

If you usually add open/close folds in the same insert operation, this will help:

http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text

If you need to move around a bunch in normal mode before adding the closing marker, it won't help as much.

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Behavior of fold when adding new fold

Ben Fritz
In reply to this post by Yichao Zhou
On Sunday, April 15, 2012 2:32:09 AM UTC-5, Yichao Zhou wrote:

> Hi, everyone.
>   I use fdm=marker.  The problem is when you add a fold, the fold
> after it will automatically open.
>
>   For example, type {{{<CR>}}}<ESC>zcggO{{{
>
>   You will find the second fold is opened automatically.  This is
> annoying when editing.  Must I reclose all the folding when add a new
> one?
>

I realized after I posted, you should also consider using zf to create fold markers rather than going into insert mode, which should prevent this problem altogether.

:help zf

Note that the 'commentstring' option is used to determine what text to place before the created fold markers.

:help fold-create-marker
:help 'commentstring'

--
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
Loading...