On 22-May-2014 01:55 +0200, Manuel Ortega wrote: > On Wed, May 21, 2014 at 2:58 PM, Teemu Ikonen <[email protected] > <mailto:[email protected]>> wrote: > > Filtering a line which is currently folded results in the whole fold > being filtered. For example, take a 2-line file like below with set > foldmethod=marker: > > one {{{1 > two > > Issuing the command ':2!echo "foo"', when the fold is open works as > expected, the line 'two' is replaced with 'foo'. > > When the fold is closed, after issuing the command both lines are > replaced with a single line 'foo'. > > Is this a bug or a feature? If the latter, how can I make the > filtering work as expected, when folds are closed? > > > It's a documented aspect of Vim. When an ex command is applied to a > line in a closed fold, the command is applied to every line in the fold. > See :h fold-behavior. > > As for solving your problem, I'm not sure. Possibly you could use a > custom command or function that temporarily opens the fold, performs the > filtering, and then refolds. Possibly you could use getline() and > friends to put the target line(s) into a tempfile, perform the necessary > operations, and setline() it back in.
I would use :set nofoldenable | ... | set foldenable for that, or the "zi" normal mode command to toggle. -- regards, ingo -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
