设为首页 加入收藏

TOP

介绍Elastic Tabstops,一个很好的想法
2014-11-23 20:17:49 】 浏览:278
Tags:介绍 Elastic Tabstops 一个 想法

什么都不说,先来看看一个 gif 演示吧:

\


如果没看明白,可以访问此网站,上面还提供了一个在线演示(需要 JavaVM),效果很不错的:
http://nickgravgaard.com/elastictabstops/
简单来说,就是辅助编辑代码,有效减少了因对齐代码插入/删除 tab 而敲击按键的次数。为了避免这个图片失效,下面就用原文提供的例子来简单说明一下:
假设我们有这么一段代码:
#include
int someDemoCode( int fred,
int wilma)
{
x(); /* try making*/
printf("hello again!\n"); /* this comment */
makeThisFunction(); /* a bit longer*/
for(i = start; i < end; ++i)
{
if (isPrime(i))
{
++numPrimes;
}
}
return numPrimes;
}
可以看到三行注释都是对齐的(如果不是,那只是网页显示的问题。。。。),又假设现在需要编辑第七行的 makeThisFunction,改成 makeThisFunctionABitLonger,那么必然会导致改行后面的注释无法跟其上两行注释对齐,可是 Elastic Tabstops 就可以在编辑的同时自动给它对齐,变成下面这样:
#include
int someDemoCode( int fred,
int wilma)
{
x(); /* try making*/
printf("hello again!\n"); /* this comment */
makeThisFunctionABitLonger(); /* a bit longer*/
for(i = start; i < end; ++i)
{
if (isPrime(i))
{
++numPrimes;
}
}
return numPrimes;
}
  
按照作者的说法,VS2010 的插件版本 will soon be available to a small number of users in the form of a limited public beta,看来还要再等一段时间才能看到实际实现起来的效果了。

摘自 劲草...无香

劲草...无香
劲草...无香

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Warning #10210 : problem with M.. 下一篇在VC中动态加载ODBC的方法

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目