gpt4 book ai didi

terminal - 为什么默认终端宽度是 80 个字符?

转载 作者:行者123 更新时间:2023-12-03 08:47:06 26 4
gpt4 key购买 nike

80 似乎是许多不同环境中的默认值,我正在寻找技术或历史原因。众所周知,代码行不应超过 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 吗?

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

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.

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 自动格式化 CtrlShiftF,默认情况下会在 80 个字符处换行。

Vim with ColorColumn enabled. Right-Click > Open Image in new tab for larger image

关于terminal - 为什么默认终端宽度是 80 个字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4651012/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com