块选择模式有什么好处?

发布于 2024-09-17 19:37:57 字数 352 浏览 5 评论 0原文

这里是 Eclipse 的长期用户;我最近发现了 Eclipse 3.5 中添加的“块选择模式”(Alt-Shift-A)。我尝试了一下,它非常简洁——我可以在源代码中选择一个文本矩形,而不是像通常那样一次选择一行内容。

显然这个功能在其他编辑器中也很常见,有“列编辑模式”等其他名称。很多人似乎真的很喜欢它,但我已经很长时间没有使用它了。

所以我的问题是:这个功能有什么用途?

我唯一能想到的就是在一大段文本前面插入注释字符(例如//或#)。另外,我想如果我有一堆排列好的变量名称,我想立即更改所有变量的第一个字符。但肯定还有更多的事情吗?我的意思是,在选择编辑器时,这个功能显然对某些人来说是一个障碍!

Longtime Eclipse user here; I recently discovered the "Block Selection Mode" (Alt-Shift-A) that was added into Eclipse 3.5. I tried it out, it's pretty neat--I can select a rectangle of text in my source code instead of selecting things a line at a time like I usually do.

Apparently this feature is common in other editors too, under other names like "column edit mode", etc. A lot of people seem to really love it, but I've got by without for a long time.

So my question is: What kinds of things is this feature useful for?

The only one I can think of is inserting a comment characters (like // or #) in front of a chunk of text. Also, I supposed if I had a bunch of variables names that were all lined up and I wanted to change the first characters for all of them at once. But surely there's more to it than that? I mean, when it comes to choosing an editor, this feature is apparently a deal-breaker for some people!

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

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

发布评论

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

评论(4

情归归情 2024-09-24 19:37:57

我发现它在处理固定位置字段数据文件时非常有用,并且您只想选择几个字段进行搜索替换或复制粘贴。它对于这样的事情也有好处:

call_foo('A',123);
call_foo('B',143);
call_foo('C',331);
call_foo('A',113);
call_foo('R',789);

除了某些列中的某些字符之外,代码都是相同的。您可以选择第二个参数周围的块并搜索包含 113 的行。当您的格式不止几行时,这很有用。

I find it is very useful when working with fixed-position field data files, and you only want to select a few fields for search-replace or copy-paste. It is also good for things like this:

call_foo('A',123);
call_foo('B',143);
call_foo('C',331);
call_foo('A',113);
call_foo('R',789);

The code is all the same except for some characters in some columns. You could select a block around the second parameter and search for the line containing 113. Useful when you have more than just a few lines all together in this format.

誰ツ都不明白 2024-09-24 19:37:57

我的一位同事告诉我,他们在一个项目中编写了这样的 JDBC 代码:

String query =
    "select question, answer, accepted " +
    "from so_answers                   " +
    "where poster = 'Jon Skeet'        " +
    "order by upvotes                  ";

这样他们就可以对 SQL 进行块选择,以便将其粘贴到数据库工具中并手动运行它。对我来说似乎有点疯狂,但这显然对他们有用。

A colleague of mine told me of a project where they wrote JDBC code like this:

String query =
    "select question, answer, accepted " +
    "from so_answers                   " +
    "where poster = 'Jon Skeet'        " +
    "order by upvotes                  ";

So that they could block-select the SQL in order to paste it into a database tool and run it by hand. Seems a bit barmy to me, but it evidently worked for them.

梦太阳 2024-09-24 19:37:57

如果您每天不使用块剪切/复制/粘贴操作至少四到五次,那么我建议您只是进行大量额外的打字。

If you arn't using a block cut/copy/paste operation at least four or five times a day then I would suggest you're just doing a lot of extra typing.

剑心龙吟 2024-09-24 19:37:57

如果您正在查看具有固定宽度字段的文件,有时您只想选择一列。

If you are looking at a file with fixed width fields, sometimes you only want to select one column.

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