使用Eclipse时,我经常使用键盘箭头浏览包浏览器树。
在Windows中,我可以通过按键来展开折叠的节点→。在Linux中,我需要按Shift+ →。有没有一种方法可以重新配置它Shift而不是必需的?
使用Eclipse时,我经常使用键盘箭头浏览包浏览器树。
在Windows中,我可以通过按键来展开折叠的节点→。在Linux中,我需要按Shift+ →。有没有一种方法可以重新配置它Shift而不是必需的?
Right
在已经扩展的节点上应该跳到第一个子Left
节点,在已经折叠的节点上应该跳到其父节点。
Answers:
我的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;
}
将其放入您的手机中~/.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以应用新的绑定
bind "<Alt>Up" { "select-cursor-parent" () }
将使您能够使用Alt-Up跳到父节点。这样,即使您当前的子节点选择不在列表中,您也可以轻松地折叠树。
如果有人想知道如何使用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;
}
安德鲁提供的答案是正确的。请注意,在较新版本的Ubuntu中,没有〜/ .gtkrc-2.0文件,因此您可以创建它,也可以编辑当前主题的gtkrc,该文件存储在
/usr/share/themes/your_theme/gtk-2.0/gtkrc
我试图使用@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;
}
注意-
之前的,gtk-key-bindings
并将其GtkTreeView
重命名为treeview
。
“树”窗口小部件的导航由底层窗口小部件工具箱-GTK控制。SWT / Eclipse无法控制它。如果需要任何此类配置来更改快捷方式,则必须从GTK本身进行设置。