Hide comments in Unix code

I work in a Unix environment with typical Unix tools (emacs, vim, gvim, sunstudio, etc.)

My project has huge general comments on each method. It makes files thousands of lines long, with several hundred lines of actual code. I can get a little carried away, but you understood this idea. I am looking for a way to view these files in order to hide (not delete) all comments so that I can quickly go through the code. Only C ++ comments '//'.

+3
source share
1 answer

It all depends on which editor you use. In vim, you can enable folding with:

set foldenable 

Then you can use different bending methods, for the main languages ​​you can set:

 set foldmethod=syntax 

which allows you to bend syntax.

There are half a dozen folding methods, I think it would be best to read

 help folding 

which should answer everything.

+7
source

All Articles