Re: vim: how to yank only displayed texts in folding
- hi chris:
On May 31, 1:21 am, "Christian Brabandt" <cbli...@...> wrote:
> On Wed, May 30, 2012 20:17, ping wrote:
> > hi Christan:
> > yes that works!
> > thanks!
> > previously I got it wrong that I visually selected my text and apply
> > the function with that range.
> > b.t.w can we actually achieve that goal based on your function here?
> I think, this should do:
> function! CopyNonFolded() range
> let lnum= a:firstline
> let buffer=
> while lnum <= a:lastline
> if (foldclosed(lnum) == -1)
> let buffer += getline(lnum, lnum)
> let lnum += 1
> let buffer += [ foldtextresult(lnum) ]
> let lnum = foldclosedend(lnum) + 1
> top new
> set bt=nofile
> call append(".",buffer)
> com! -range=% CopyFolds :<line1>,<line2>call CopyNonFolded()
> You can then use the command Copyfolds with or without a selected range
> (in which case it selects the complete file).
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