IntelliJ IDEA 虚拟空间的目的是什么?

发布于 2024-11-03 06:01:24 字数 348 浏览 1 评论 0原文

在 Eclipse 中,默认情况下禁用虚拟空间(可以在行尾放置插入符号),这与 IntelliJ IDEA 默认设置相反。 http://www.jetbrains.com/idea/documentation/migration_faq.html

您想要将插入符号放在行尾之后是否有特殊原因?我试图想出它的一个用例,但想不出任何…

我问的原因是因为它是 IntelliJ 中的默认设置,这让我很好奇。

In Eclipse, virtual space (the possibility to place the caret after the end of a line) is disabled by default, which is contrary to IntelliJ IDEA default setting. http://www.jetbrains.com/idea/documentation/migration_faq.html

Is there a particular reason why you would want to place the caret after the end of the line? I'm trying to think of a use-case for it but can't come up with any...

The reason I ask because it is the default setting in IntelliJ which makes me curious.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

眼中杀气 2024-11-10 06:01:24

对于我这个老程序员来说这个问题真的很奇怪。问题应该是为什么这么多新编辑器不提供这个古老的功能。 (与块/矩形编辑一起)。

简而言之,我希望能够以任何方式移动我的文本,而不是局限于某人之前输入过的位置。屏幕代表一段文本的矩形图像(想想这里的隐喻等)。我希望能够到达这个矩形空间内的任何地方,而不会被底层文件的外观所阻止。

示例:如果我们有三行文本:

Line1:这是一个包含大量文本的长行。
Line2:这是一条较短的线。
Line3:这是带有文本的第三行。

如果我位于第 2 行的末尾并且想要导航到第 1 行的末尾,我希望能够向右(多次)然后向上,这是在虚拟空间中执行此操作的一种方法,但在新型编辑器(以一种非常古老的以文件为中心的方式运行)如果我在第 2 行末尾按右键,我将在第 3 行的开头结束。这有什么意义呢?当然,这模仿了文件中的“向前迈出一步”,但隐喻地说我想去其他地方。

我真的认为这是一条相当倒退的路。

作为一个终点 - 这是许多(年轻?)程序员的症状,他们以前没有见过这么多操作系统和编辑器,其中一些操作系统和编辑器根本不比今天的系统差。 Linux/Unix不是世界,还有很多更好的系统值得我们学习。

For me as an old programmer this question is really weird. The question ought to be why so many new editors don't offer this age old feature. (Together with block/rectangular editing).

Simply put, I want to be able to move around my text in any way, not being restricted to where someone has typed before. The screen represents a rectangular image of a piece of text (think metaphores here etc). I expect to be able to go anywhere within this rectangular space without being stopped by how the underlying file looks.

Example: If we have three lines of text:

Line1: This is a long line with lots of text in it.
Line2: This is a shorter line.
Line3: This is a third line with text.

If I am at the end of line 2 and want to navigate to the end of line 1 I want to be able to go right (a number of times) and then up, which is one way to do it in virtual space, but in the new kind of editors (which behave in a very old file-centric way) if I press right at the end of line 2 I will end up at the beginning of line 3. What's the point of that? Of course that mimics a "step forward" in the file, but metaphorically I wanted to go somewhere else.

I really think this is a quite backwards way to go.

And as an end point - this is symtomatic of many (young?) programmers who haven't seen so many operating systems and editors from before, some of which were not at all worse than todays systems. Linux/Unix is not the world, there were many better systems that we could learn from.

新一帅帅 2024-11-10 06:01:24

我一直在等待有人回答这个问题。这是一个非常有趣的问题,我希望一些老前辈能回答它......(因为我也无法清楚地理解它......)以下是摘录自 Visual Studio 提示

“好吧。如果你不是来自老派,虚拟空间有点难以理解。你看,很久以前,在这个银河系中,我们曾经有(有些人仍然有)编辑器,将任何地方都视为可编辑空间。让我解释一下:在代码结束的地方没有虚拟空间,现在你可以有一些很长的代码行,但是,

如果我将光标移动到任何一行的末尾 ,直到你按下 Enter 键,该行就会继续下去。这些行并按我的右箭头键那么它将跳到下一行,因此,对于短行,光标将跳到第 44 列的下一行。对于较长的行,它将跳到第 68 列的下一行。对于超级长行,光标将跳到下一行。它会跳转到第 176 列的下一行。编辑器的这种方式已经有一段时间了,对于人们来说并不是什么新鲜事。

但是,这种方式并不总是如此。曾经有一段时间,您可以键入。任何你想要的地方 任何你想要的时间 无需一些文本编辑器今天仍然这样做。虚拟空间允许您回到某些程序员喜欢的旧编辑方式。转到工具 ->选项->文本编辑器 ->所有语言 ->一般->设置并选中“启用虚拟空间”复选框以打开此功能。当你这样做时,无论代码是否结束,你都可以在一行中的任意位置键入:”

I was waiting for someone to answer this question. This is a really interesting question and I was hoping some old timer will answer it... (Since I cannot clearly Understand it either...) The following is an excerpt from Visual Studio Tips.

"Okay. Virtual space is a little funky to understand if you aren't from the Old School. You see, a loooooong time ago in this galaxy we used to have (and some people still have) editors that treat everywhere as editable space. Let me explain: Without virtual space on the line ends where the code ends. Now you can have some really long lines of code but, until you press Enter, the line just keeps on going.

If I move my cursor to the end of any of these lines and hit my Right Arrow key then it will go to the next line. So, for the short line the cursor will jump down to the next line at column 44. For the longer line it will jump down the next line at column 68. And for the super duper long line it will jump to the next line at column 176. This is the way editors have been for a while now and isn't really new to folks.

However, this way wasn't always the case. There was a time when you could type anywhere you wanted any time you wanted without restriction. Some text editors still do this today. Virtual space allows you to go back to the old style of editing which is preferred by some coders. Go to Tools -> Options -> Text Editor -> All Languages -> General -> Settings and check the "Enable virtual space" checkbox to turn this feature on. When you do, you will be able to type anywhere on a line regardless of whether the code ends or not:"

陌伤浅笑 2024-11-10 06:01:24

虚拟空间使您可以更自由地将源代码视为二维字符矩阵,而不是像流动的文本行。这对于以下方面非常有帮助:

  • 当跨多行时,在同一列上对齐各种结构(变量名称、类型等)。

  • 使用块选择。

许多人(包括我)喜欢尽可能使用块编辑,而块编辑很大程度上依赖于块选择。

在 Intellij 中,块选择是通过按住 Alt 并拖动鼠标来实现的。

如果您没有在 Intellij 中选中Allowplace of caret after end of line选项,您会发现块选择更加困难,几乎不可能。这是因为编辑器经常阻止您将光标放置在行尾之外,但通常这正是您想要放置光标的位置,因为您打算选择跨越多行的多列的整个矩形。

始终启用虚拟空间对任何人来说都不应该成为问题。如果您无意中将插入符号放置在当前行末尾之外,并且您希望将其放在末尾,则只需按 End 键即可。

Virtual space gives you more freedom in treating your source code as a two-dimensional matrix of characters, rather than like flowing lines of text. This is very helpful for:

  • Aligning various constructs (variable names, types, etc.) on the same column when they span over multiple lines.

  • Using block selection.

Many people (me included) like to use block editing whenever possible, and block editing relies heavily on block selection.

In Intellij, block selection is achieved by holding down Alt while dragging the mouse.

If you do not have the Allow placement of caret after end of line option checked in Intellij, you will find that block selection is much harder, almost impossible. This is because the editor is often preventing you from placing the cursor beyond the end of a line, but quite often that is precisely where you want to place it, because you intend to select an entire rectangle spanning multiple columns over multiple rows.

Having virtual space always enabled should not really be a problem to anyone. If you unintentionally place your caret beyond the end of the current line, and you want it at the end, all you need to do is press the End key.

嘿看小鸭子会跑 2024-11-10 06:01:24

它使排列行尾注释/代码更容易,或者在非代码、柱状数据等中排列行尾注释/代码更容易。在某些情况下,它可以省去很多麻烦。

我默认将其关闭,尽管带来了一位相对较老的程序员,他从画布样式编辑器(而不是线条样式)开始。

It makes lining up end-of-line comments/code easier, or in non-code, columnar data/etc. Under some circumstances it saves a lot of hassle.

I have it off by default, despite bring a relatively old programmer who started off with canvas-style editors (as opposed to line-style).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文