Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用典型的 Unix 工具(emacs、vim、gvim、sunstudio 等)在 Unix 环境中工作
我的项目对每种方法都有大量的样板评论。它使文件长达数千行,实际代码只有几百行。我可能有点夸张,但你明白了。我正在寻找一种在查看这些文件时隐藏(而不是删除)所有评论的方法,以便我可以快速浏览代码。仅 C++ 注释 '//'。
这完全取决于您使用的编辑器。在 vim 中,您可以使用以下命令启用折叠:
set foldenable
然后,您将能够使用不同的折叠方法,对于主流语言,您可以设置:
set foldmethod=syntax
这将启用语法折叠。
有六种折叠方法,我认为最好是阅读
help folding
这应该回答一切。