Monday, August 1, 2011

Moving a fold? [Was: A mile of dashes added to foldtext]

On 01.08.11 10:38, Paul wrote:
> On Mon, Aug 01, 2011 at 06:15:38PM +1000, Erik Christiansen wrote:
> >But how to remove the extra "--------- ... ------------------" hoo-haa?
>
> Try setting 'fold:' in fillchars, eg. set fillchars="fold: "


Paul, you're a wizard. :-)
Many thanks for that magical fix!

Now I can settle down to examine how useful folding is, but even while
only experimenting, it's a marvel.

The new difficulty:
-------------------
Vim's help has a number of fold-related commands, but I'm having trouble
finding a command to delete a fold, for pasting elsewhere. So not zd,
---------------------------
which just negates the fold. (The perspective provided by folding
reveals that some folds need to be moved.)

Perhaps there is a "to end of fold" motion, to use with d, even though I
don't see one in motion.txt.

Folding is already looking good, with the size of each fold visible, but
secondary, and in pages rather than lines:

GCC:---------------------- G++ ---------------------------COMPILER: 14 P
...
VIM:--------------------------------------------------------------- 17 P

(Thanks to Gary Johnson for fold line count arithmetic, in an older post.)

My right justification is crude:

let n = v:foldend - v:foldstart + 1
let s = " "
let p = n/60 " Lines per page.
if p > 9
let s = ""
endif
return sub . s . p . " P"

and will fail if a fold runs to more than 99 pages, but it will do for a
first attempt at vim scripting.

Erik

--
The poetry of heroism appeals irresistibly to those who don't go to a
war, and even more so to those whom the war is making enormously wealthy.
- Celine

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

No comments:

Post a Comment