在Linux上的Eclipse中,是否可以单独使用箭头键来展开包资源pipe理器中的树节点?

使用Eclipse时,我使用键盘箭头浏览包浏览器树。

在Windows中,我可以通过按键展开折叠的节点。 在Linux中,我需要按Shift + 。 有没有办法重新configuration,以便Shift不是必需的?

把这个放到你的~/.gtkrc-2.0 ,你应该很好走。 左边和右边的线做出了所要求的改变,其余的只是我个人的补充,使树视图行为更像vim。 希望有所帮助!

 binding "gtk-binding-tree-view" { bind "j" { "move-cursor" (display-lines, 1) } bind "k" { "move-cursor" (display-lines, -1) } bind "h" { "expand-collapse-cursor-row" (1,0,0) } bind "l" { "expand-collapse-cursor-row" (1,1,0) } bind "o" { "move-cursor" (pages, 1) } bind "u" { "move-cursor" (pages, -1) } bind "g" { "move-cursor" (buffer-ends, -1) } bind "y" { "move-cursor" (buffer-ends, 1) } bind "p" { "select-cursor-parent" () } bind "Left" { "expand-collapse-cursor-row" (0,0,0) } bind "Right" { "expand-collapse-cursor-row" (0,1,0) } bind "semicolon" { "expand-collapse-cursor-row" (0,1,1) } bind "slash" { "start-interactive-search" () } } class "GtkTreeView" binding "gtk-binding-tree-view" 

然后重新启动Eclipse以应用新的绑定

如果有人想知道如何使用GTK3做到这一点 – 只需打开~/.config/gtk-3.0/gtk.css并添加以下内容:

 @binding-set MyTreeViewBinding { bind "Left" { "expand-collapse-cursor-row" (0,0,0) }; bind "Right" { "expand-collapse-cursor-row" (0,1,0) }; } GtkTreeView { gtk-key-bindings: MyTreeViewBinding; } 

我的GTK3版本的行为更自然。 将以下内容添加到〜/ .config / gtk-3.0 / gtk.css中:

 @binding-set MyTreeViewBinding { bind "Left" { "select-cursor-parent" () "expand-collapse-cursor-row" (0,0,0) }; bind "Right" { "expand-collapse-cursor-row" (0,1,0) }; } GtkTreeView { gtk-key-bindings: MyTreeViewBinding; } 

Andrew提供的答案是正确的。 请注意,在较新版本的Ubuntu中没有〜/ .gtkrc-2.0文件,所以您可以创build它,或者您可以编辑当前主题的gtkrc,它存储在

/usr/share/themes/your_theme/gtk-2.0/gtkrc

Tree小部件的导航由小部件工具箱(GTK)控制。 SWT / Eclipse无法控制它。 如果需要更改快捷方式的configuration,则必须由GTK方面进行。