> What i wanna is: see my file as if there is no comment at all.
> In other words, toogle btw hide/unhide comments. Is there a
> simple way of doing that?
If you're willing to have multi-line comments folded down to a
single line (which it sounds like you want; rather than having
*no* lines showing the folded/hidden comments) and your
file-syntax has support for identifying/folding comments, you can
just use
zR " open all folds in the file
zM " close all folds in the file
However, this also closes other types of defined folds (code
blocks, etc) which may or may not be what you want.
You can target those folded-comment lines with something like
:g/\/\*/foldopen!
:g/\/\*/foldclose!
which will execute ":foldopen!" or ":foldclose!" on each line
containing "/*" (adjust for the comment-opening token in your
language of choice).
Finally, if you don't have *any* folds defined in your file, you
can create them with
:set foldmethod=marker foldmarker=/*,*/
and then use the above zR/zM commands to open/close them. For
more information on any of the above, you can read the help at:
:help zR
:help zM
:help :g
:help :foldopen
:help :foldclose
:help 'foldmethod'
:help 'foldmarker'
Hope this gives you what you want,
-tim
--
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