在Linux上的Eclipse中,是否可以单独使用箭头键来扩展包浏览器中的树节点?

Alb*_*Alb 69 eclipse linux ide ubuntu keyboard-shortcuts

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

在Windows中,我可以通过按键展开折叠节点.在Linux中我需要按Shift+ .有没有办法重新配置这个Shift不需要?

And*_*rew 112

把它放到你的~/.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"
Run Code Online (Sandbox Code Playgroud)

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

  • 我想如此努力地拥抱你.这已经困扰了我几个月! (5认同)
  • 哇谢谢!我几乎放弃了这个. (4认同)
  • +1000,我的生活质量大幅提高;-) (3认同)
  • 当前选择在文件夹上时,它确实很好用.但是左箭头行为仍然与Windows上的完全不同.在已折叠的文件夹中,它会将您带到父文件夹.此外,当前选择是文件时,它会将您带到父文件夹.但是在Mint上它仍然保留在当前选择中.但这仍然是一个巨大的进步,谢谢! (3认同)
  • 这对Eclipse Luna来说很有效,任何想法为何停止工作? (2认同)
  • 添加 `bind "<Alt>Up" { "select-cursor-parent" () }` 将使您能够使用 Alt-Up 跳转到父节点。然后,即使当前选择的子节点位于列表的最下方,您也可以轻松折叠树。 (2认同)

big*_*erd 30

如果有人想知道如何使用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;
}
Run Code Online (Sandbox Code Playgroud)


小智 18

我的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;
}
Run Code Online (Sandbox Code Playgroud)


Seb*_*ano 12

安德鲁提供的答案是正确的.请注意,在较新版本的Ubuntu中没有〜/ .gtkrc-2.0文件,因此您可以创建它,也可以编辑当前主题的gtkrc,该主题存储在

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

  • 由于我最近切换到Linux Mint(Cinnamon),我试图弄清楚如何恢复这个有用的技巧,因为your_theme文件夹不包含任何gtk*文件.答案是这个文件:/usr/share/themes/Default/gtk-2.0-key/gtkrc (4认同)

YMo*_*omb 5

我尝试使用@Andrew Lazarev 的答案。然而,由于 GTK3.20 ( https://bugzilla.gnome.org/show_bug.cgi?id=766166 ) 上的非向后兼容更改,必须稍微调整绑定:

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

treeview
{
   -gtk-key-bindings: MyTreeViewBinding;
}
Run Code Online (Sandbox Code Playgroud)

请注意-之前的内容gtk-key-bindings并重GtkTreeView命名为treeview.