Java Eclipse 中的书签、设置和使用热键,它们是否存在?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3141493/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 16:48:05  来源:igfitidea点击:

Bookmarks in Eclipse, set and go using hotkeys, do they exist?

javaeclipse

提问by EugeneP

Bookmarks in Eclipse, set and go using hotkeys, do they exist?

Eclipse 中的书签、设置和使用热键,它们是否存在?

Say, Ctrl+Shift+1= Set 1 bookmark

说,Ctrl+ Shift+ 1= 设置 1 个书签

Ctrl+1= go to the place first bookmark was set

Ctrl+ 1= 转到设置第一个书签的位置

回答by pbanfi

In Eclipse 3.5 there are some bookmarks related actions cthat can be linked to key shortcuts: to bind them you have to go to menu Window > Preferences > General > Keysand use the word "bookmark" as filter.

在 Eclipse 3.5 中,有一些与书签相关的操作可以链接到快捷键:要绑定它们,您必须转到菜单Window > Preferences > General > Keys并使用单词“bookmark”作为过滤器。

Saluti

萨卢蒂

回答by VonC

Not exactly.

不完全是。

You can only assign a shortcut to add a new bookmark (like I did in the picture below).
But you can go to the bookmark you have just defined only through the "Bookmarks" View (the second shortcut would only display the Bookmark view)

您只能指定一个快捷方式来添加新书签(就像我在下图中所做的那样)。
但是您只能通过“书签”视图转到您刚刚定义的书签(第二个快捷方式只会显示书签视图)

http://img84.i_mageshack.us/img84/6631/eclipsebookmark.png

http://img84.i_mageshack.us/img84/6631/eclipsebookmark.png

回答by Bill the Lizard

I don't think so. You can assign a shortcut to make bookmarks, but I don't think you can specify a hotkey for each individual bookmark you create.

我不这么认为。您可以指定一个快捷方式来制作书签,但我认为您不能为您创建的每个书签指定一个热键。

In Eclipse 3.5, if you go to Windows > Preferences > General > Keysyou'll find the Add Bookmarkcommand. Add a hotkey in that dialog.

在 Eclipse 3.5 中,如果您转到Windows > Preferences > General > Keys,您将找到Add Bookmark命令。在该对话框中添加一个热键。

Then go to Window > Show View > Other... > Bookmarksto display the bookmarks tab.

然后转到“窗口”>“显示视图”>“其他...”>“书签”以显示书签选项卡。

Eclipse bookmarks tab

Eclipse 书签选项卡

As you would probably expect, double-clicking the entries in the bookmarks tab takes you to the bookmarked line of code.

正如您可能期望的那样,双击书签选项卡中的条目会将您带到带有书签的代码行。

回答by n611x007

Yes. You need to set a shortcut key for Add Bookmark. Go to Window > Preferences > General > Keysand enter the text filter "bookmark". Add bookmarkwill be listed, select it. Now bind a new shortcut in Binding. Make sure that there are no conflicts.

是的。您需要为 设置快捷键Add Bookmark。转到“窗口”>“首选项”>“常规”>“键”并输入文本过滤器“书签”。Add bookmark将被列出,选择它。现在绑定一个新的快捷方式Binding。确保没有冲突。

bookmarks

书签

It may be also a good idea to assign a shortcut to "Show View (Bookmarks)" where all your bookmarks are listed. Alternatively this can be enabled via Window > Show view > Other(shortcut Alt+Shift+Q, Q) > and filter to "bookmark".

为列出所有书签的“显示视图(书签)”分配一个快捷方式也可能是一个好主意。或者,这可以通过“窗口”>“显示视图”>“其他”(快捷方式Alt+ Shift+ QQ)> 并过滤到“书签”来启用。

From here on, you can set new bookmarks. Eclipse will want you to name your bookmarks.

从这里开始,您可以设置新书签。Eclipse 会希望您为书签命名。

You can navigate these bookmarks, using "Next Annotation" Ctrl+.and "Previous Annotation" Ctrl+,butyou need to enable jumping to bookmarksfirst via the dropdown of these two in the annotations toolbar:

您可以使用“下一个注释” Ctrl+.和“上一个注释” Ctrl+导航这些书签,,您需要首先通过注释工具栏中这两个的下拉菜单启用跳转到书签

annot toolbar

注释工具栏

image source: tutorialby vogella

图片来源:vogella 的教程

So select any of the two dropdown and enable "Bookmarks":

因此,选择两个下拉列表中的任何一个并启用“书签”:

Bookmarks

书签

If you don't want other annotations such as Errors and Warnings to be included in the navigation, disable them in the toolbar dropdown for next/previous annotation.

如果您不希望导航中包含其他注释(例如错误和警告),请在下一个/上一个注释的工具栏下拉列表中禁用它们。

The shortcut for Next/Previous Annotation can also be changed in the Preferences. Their category is Navigate, when: In Windows, you can filter to their names: Nextand Previous.

下一个/上一个注释的快捷方式也可以在首选项中更改。他们的类别是Navigate, when: In Windows,你可以过滤到他们的名字:NextPrevious

回答by Pierre Thibault

I was not really satisfy with what Eclipse has to offer. But I found a plugin called Quick Bookmarks. See Quick Bookmarks. I love it! I can assign a shortcut to a specif bookmark. Just what I needed. It works with every text file.

我对 Eclipse 所提供的东西并不真正满意。但是我找到了一个名为 Quick Bookmarks 的插件。请参阅快速书签。我喜欢它!我可以为特定书签分配快捷方式。正是我所需要的。它适用于每个文本文件。

回答by Gurce

Additional info: I've got Eclipse Kepler (v4.3) and as mentioned earlier, I've seen a few more bookmark commands available. Of particular interest is the "Next Bookmark" command, which is worth binding a keyboard shortcut to. This will work similar to the "Next Annotation" command, except only jumps to the bookmarks.

附加信息:我有 Eclipse Kepler (v4.3) 并且如前所述,我看到了更多可用的书签命令。特别有趣的是“下一个书签”命令,值得绑定一个键盘快捷键。这将类似于“下一个注释”命令,除了仅跳转到书签。

Warning: I've noticed that if you edit a file outside of eclipse and then return back to eclipse, you will have lost all your bookmarks, not nice.

警告:我注意到,如果您在 eclipse 之外编辑一个文件,然后返回到 eclipse,您将丢失所有书签,这不太好。

回答by Alisa

I personally like these settings:

我个人喜欢这些设置:

  1. Go to Window> Preferences> General> Keys
  2. Type "bookmark" as the filterand select "Add Bookmark"
  3. Click in the box related to bindingat the bottom.
  4. Erase previously assigned hotkeys with deleteor backspaceThen hit Ctrl+ Shift+ A
  5. Similarly select "Go to next bookmark"and assign Ctrl+ Bto it.
  6. Finally, select "Toggle Bookmark"at the bottom, and assign Ctrl+ Shift+ Bto it.
  1. 转到窗口>首选项>常规>
  2. 输入“书签”作为过滤器,然后选择“添加书签”
  3. 单击底部与绑定相关的框。
  4. delete或擦除之前分配的热键backspace然后点击Ctrl+ Shift+A
  5. 同样选择“转到下一个书签”并为其分配Ctrl+ B
  6. 最后,选择“切换书签”在底部,并指定Ctrl+ Shift+B给它。

This way you can:

这样你可以:

  • hit Ctrl+ Shift+ Ato add a bookmark with name(which is shown if you open the Bookmarks view with the name you entered and you can double click on it to go to that line).
  • hit Ctrl+ Shift+ Bto add a bookmark without name(which is also shown in the Bookmarks view but named as "Quick bookmark").
  • hit Ctrl+ Bto switch between bookmarksand is very handy if you have a few number of bookmarks.
  • 命中Ctrl+ Shift+ A,以增加与名称的书签(如果打开书签与您输入的名称视图,可以双击它,去到该行被示出)。
  • 命中Ctrl+ Shift+ B,以添加无名称的书签(也显示在书签视图,但命名为“快速书签”)。
  • 命中Ctrl+B书签之间切换,非常方便,如果你有书签的极少数。