preserving folds when yanking/pasting from register

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

preserving folds when yanking/pasting from register

Liraz.Siri

Hello Vimperialists,

I use manual folding a lot for free form text I am working with. Helps
me keep sight of the big picture.
I save my views automatically so that my manual folds persist across
Vim sessions.

Trouble is, I am have a difficult time editing / rearranging blocks of
manually folded text because every time I cut and paste or copy and
paste Vim forgets my folds.

Does anyone know how I can get Vim to preserve folds when I cut and
paste them?

If this can't be done with a Vim option or existing extension any
advice on how I could extend Vim to do this would be appreciated. I
can program in Vimscript and have written a couple of extensions for
personal use.

Cheers,
Liraz
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: preserving folds when yanking/pasting from register

Muthusubramanian NV
Hello Vimperialists,

I use manual folding a lot for free form text I am working with. Helps
me keep sight of the big picture.
I save my views automatically so that my manual folds persist across
Vim sessions.

Trouble is, I am have a difficult time editing / rearranging blocks of
manually folded text because every time I cut and paste or copy and
paste Vim forgets my folds.

Doesn't  set foldenable  do the necessary folding automatically, even when copy/paste or cut/pasting?



--
Muthusubramanian N V,
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: preserving folds when yanking/pasting from register

Jeenu V
In reply to this post by Liraz.Siri

Not sure whether you can accomplish with foldmethod set to manual.
However, if you set foldmethod=marker, you can preserve folds across
copy-pastes.

See:
:help 'foldmethod'
:help 'foldmarker'

On Mar 23, 10:11 am, Liraz <[hidden email]> wrote:

> Hello Vimperialists,
>
> I use manual folding a lot for free form text I am working with. Helps
> me keep sight of the big picture.
> I save my views automatically so that my manual folds persist across
> Vim sessions.
>
> Trouble is, I am have a difficult time editing / rearranging blocks of
> manually folded text because every time I cut and paste or copy and
> paste Vim forgets my folds.
>
> Does anyone know how I can get Vim to preserve folds when I cut and
> paste them?
>
> If this can't be done with a Vim option or existing extension any
> advice on how I could extend Vim to do this would be appreciated. I
> can program in Vimscript and have written a couple of extensions for
> personal use.
>
> Cheers,
> Liraz
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: preserving folds when yanking/pasting from register

Ben Schmidt
In reply to this post by Liraz.Siri

Liraz wrote:

> Hello Vimperialists,
>
> I use manual folding a lot for free form text I am working with. Helps
> me keep sight of the big picture.
> I save my views automatically so that my manual folds persist across
> Vim sessions.
>
> Trouble is, I am have a difficult time editing / rearranging blocks of
> manually folded text because every time I cut and paste or copy and
> paste Vim forgets my folds.

I presume you mean that folds not related to the text being yanked and put are
messed up. Are they deleted, or simply opened (i.e. can you close them by moving
into them and doing a zc)? If they are still there, and just opened, are they
still in the correct places?

I believe this is a known bug that nobody has managed to fix yet, but that I am
interested in looking at because it really annoys me too (though not with manual
folding).

Vim will not yank and put manual folds along with text, though with a bit of
Vimscript I imagine you could make this happen. If this is what you were after,
then we can discuss further.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: preserving folds when yanking/pasting from register

Ben Schmidt

Ben Schmidt wrote:

> Liraz wrote:
>> Hello Vimperialists,
>>
>> I use manual folding a lot for free form text I am working with. Helps
>> me keep sight of the big picture.
>> I save my views automatically so that my manual folds persist across
>> Vim sessions.
>>
>> Trouble is, I am have a difficult time editing / rearranging blocks of
>> manually folded text because every time I cut and paste or copy and
>> paste Vim forgets my folds.
>
> I presume you mean that folds not related to the text being yanked and put are
> messed up. Are they deleted, or simply opened (i.e. can you close them by moving
> into them and doing a zc)? If they are still there, and just opened, are they
> still in the correct places?
>
> I believe this is a known bug that nobody has managed to fix yet, but that I am
> interested in looking at because it really annoys me too (though not with manual
> folding).

Hmmm. Actually, I am struggling to reproduce this behaviour with a recent version
of Vim, so maybe one of the other patches to do with folding (or something else
for that matter) fixed it. Which version of Vim are you using? Which patches are
compiled in? (Do :version to get this info.)

Ben.

>
> Vim will not yank and put manual folds along with text, though with a bit of
> Vimscript I imagine you could make this happen. If this is what you were after,
> then we can discuss further.
>
> Ben.
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: preserving folds when yanking/pasting from register

Zbigniew Kowalski

I'm having a parallel problem, when i insert new fold all existing
ones are open.
I'm using VIM 7.1 and the fold settings are as presented below. I
agree It is irritating. I never thought on that as a bug: just too
lazy to search man. If someone knows straightaway how to make it i'll
be grateful for advice

regards
Zbikow

foldclose=
foldcolumn=0
foldenable
foldexpr=0
foldignore=#
foldlevel=0
foldlevelstart=-1
foldmethod=marker
foldminlines=1
foldnestmax=20
foldmarker={{{,}}}
foldopen=block,hor,mark,percent,quickfix,search,tag,undo
sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,globals
viewoptions=folds,options,cursor

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---