为什么默认终端宽度为80个字符? [英] Why is the default terminal width 80 characters?

查看:38
本文介绍了为什么默认终端宽度为80个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

80似乎是许多不同环境中的默认设置,我正在寻找技术或历史原因.众所周知,代码行不应超过80个字符,但是我很难找到一个原因,使某些人可能会感到烦恼"之外.

80 seems to be the default in many different environments and I'm looking for a technical or historical reason. It is common knowledge that lines of code shouldn't exceed 80 characters, but I'm hard pressed to find a reason why outside of "some people might get annoyed."

推荐答案

根据Wikipedia:

As per Wikipedia:

每行80个字符的历史记录是穿孔后得出的 卡 后来广泛用于监视器文本模式

80 chars per line is historically descended from punched cards and later broadly used in monitor text mode

来源: http://en.wikipedia.org/wiki/Characters_per_line

我仍要使用80 CPL吗?

许多开发人员争辩说即使您可以使用80 CPL,也要使用80 CPL.引用自: http://richarddingwall .name/2008/05/31/is-the-80-character-line-limit-still-relevant/

Many developers argue to use 80 CPL even if you could use more. Quoting from: http://richarddingwall.name/2008/05/31/is-the-80-character-line-limit-still-relevant/

跨越显示器太长的长线很难看清.这 是字体101.您的线长越短,您的眼睛就越少 必须去看它.

Long lines that span too far across the monitor are hard to read. This is typography 101. The shorter your line lengths, the less your eye has to travel to see it.

如果您的代码足够狭窄,则可以在屏幕侧面容纳两个文件 并排,在同一时间.如果您要进行比较,这可能非常有用 文件,或者看着您的应用程序与调试器并排运行 实时

If your code is narrow enough, you can fit two files on screen, side by side, at the same time. This can be very useful if you’re comparing files, or watching your application run side-by-side with a debugger in real time.

此外,如果您编写的代码宽度为80列,则可以放心地知道 您的代码在任何情况下都是可读且可维护的 世界上的计算机.

Plus, if you write code 80 columns wide, you can relax knowing that your code will be readable and maintainable on more-or-less any computer in the world.

另一个不错的副作用是,狭窄代码段非常多 更容易嵌入文档或博客文章中.

Another nice side effect is that snippets of narrow code are much easier to embed into documents or blog posts.

作为Vim用户,我将ColorColumn=80保留在~/.vimrc中.如果我没记错的话,Eclipse自动格式化 Ctrl Shift F ,默认情况下以80个字符分隔行.

As a Vim user, I keep ColorColumn=80 in my ~/.vimrc. If I remember correctly, Eclipse autoformat CtrlShiftF, breaks lines at 80 chars by default.

这篇关于为什么默认终端宽度为80个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆