如何临时显示文件的快照,同时隐藏注释和空白行?
目的是在密集页面格式化中获取C++函数(例如)的捕获.
这样做的方法是使用全局命令过滤掉注释行
:g!/\/\/
Run Code Online (Sandbox Code Playgroud)
但随后语法高亮和移动控件消失.
Vim的折叠功能是一种完成这项工作的方法,但它只会将几个连续的注释减少到视觉上侵入的单行.
无论如何,折叠对于隐藏长C类注释仍然很有用,例如:
:set foldmethod=marker
:set foldmarker=/*,*/
Run Code Online (Sandbox Code Playgroud)
但是我没有设法在一个命令中轻松地折叠C(/ ... /)和C++(// ...)注释.
理想的伎俩是:
以便转换以下代码:
/** Let say hello
* and do not forget anybody
*/
void hello( int arg )
{
// OMG an hello world!
std::cout << "hello" << std::endl;
} // where is the world?
Run Code Online (Sandbox Code Playgroud)
进入以下缓冲区:
void hello( int arg )
{
std::cout << "hello" << std::endl;
}
Run Code Online (Sandbox Code Playgroud) 我不确定为什么不使用g ++编译以下代码:
t.cpp: In instantiation of ‘Distrib<double>’:
t.cpp:28:56: instantiated from ‘Sampler<Distrib<Solution<double> > >’
t.cpp:35:48: instantiated from here
t.cpp:16:45: erreur: ‘double’ is not a class, struct, or union type
t.cpp:18:43: erreur: ‘double’ is not a class, struct, or union type
Run Code Online (Sandbox Code Playgroud)
我期望能够AtomType在嵌套模板之间传播类型……
t.cpp: In instantiation of ‘Distrib<double>’:
t.cpp:28:56: instantiated from ‘Sampler<Distrib<Solution<double> > >’
t.cpp:35:48: instantiated from here
t.cpp:16:45: erreur: ‘double’ is not a class, struct, or union type
t.cpp:18:43: erreur: ‘double’ is not a class, struct, or union type
Run Code Online (Sandbox Code Playgroud)