Saturday, January 26, 2013

Re: How to use fold-marker method with manpage sourcecode?

On 01/26/2013 04:41 PM, Charlie Kester wrote:
> Hi vimmers,
>
> I'm editing a fairly lengthy manpage, so I'd like to be able to use vim
> folding to make the task easier.
>
> I'd like to use fdm=fold-marker, to make my folds persistent, but I
> can't figure out how to make this compatible with troff-style comments.
>
> If I select a set of lines and press zf, vim folds the lines and adds
> /*{{{*/ and /*}}}*/ to the first and last lines respectively (which were
> blank before the fold).
>
> For manpage code, I want that to be .\"{{{ and .\"}}}, since troff
> comments are lines beginning with dot backlash doublequote.
>
> Reading vim's online help for foldmarker, I see that I need to set
> commentstring. But what syntax should I use to specify the backslash and
> quote characters?
>
> I tried set commentstring=.\"
> and set commentstring=".\\\""
> and set commentstring='.\\\"'
> but none of these worked.
>
> There's probably an obvious solution here, but I'm not seeing it.
>

Nevermind, I finally saw my (obvious) mistake. It should be:

set commentstring=.\\\"%s

I forgot the %s. Added that and now zf works exactly as desired.

Sorry for the noise, but at least the answer is out there in case some
else makes the same mistake.

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