Can I use only the arrow keys to expand the node tree in the package explorer in Eclipse on Linux?

When using Eclipse, I browse the package explorer tree using the keyboard arrows.

On Windows, I can expand the crumpled node by pressing the key. On Linux, I need to press Shift + . Is there a way to reconfigure it so that Shift is not required?

+68
eclipse linux ubuntu ide keyboard-shortcuts
Jan 20 '11 at 12:45
source share
7 answers

Put this in your ~/.gtkrc-2.0 and you should be good to go. The left and right lines make the requested change, the rest are my personal additions to make the tree effect more like vim. Hope this helps!

 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" 

then restart Eclipse to apply the new bindings

+110
Nov 18 2018-11-11T00:
source share

If anyone is interested in how to do this with GTK3, just open ~/.config/gtk-3.0/gtk.css and add the following:

 @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; } 
+29
Aug 08 '14 at 19:15
source share

My version for GTK3, which behaves in a more natural way. Add the following to ~ / .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; } 
+17
Sep 11 '15 at 17:52
source share

The answer provided by Andrew is correct. Please note that in newer versions of Ubuntu there is no ~ / .gtkrc-2.0 file, so you can either create one or edit gtkrc of the current theme, which is stored in

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

+12
May 01 '12 at 10:36
source share

Tree widget navigation is controlled by a subclass of widget toolkit - GTK. SWT / Eclipse does not control it. If any such configuration is required to change the short circuit, then it must be done on the GTK side itself.

+2
Jan 21 2018-11-11T00:
source share

I tried to use @ Andrey Lazarev's answer . However, due to non-backward compatible changes in GTK3.20 ( https://bugzilla.gnome.org/show_bug.cgi?id=766166 ) the bindings should be slightly adapted:

 @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; } 

Please note - before gtk-key-bindings and GtkTreeView renamed to treeview .

0
Apr 05 '19 at 13:56 on
source share

Here I found a good recommendation for binding the left key to a tree. I would like to improve this, but I do not know how to do it. I found a couple of test-collapse-row and test-expand-row methods in the link below https://developer.gnome.org/gtk3/stable/GtkTreeView.html#GtkTreeView-select-cursor- string to check the current row on expandable or not. I need, if it is a node, and it is not collapsed, collapse it, but if it is not a node, or it is already collapsed, set the pointer to the parent, but do not collapse it. I tried to find an example with a condition for CSS key bindings, but have not yet found.

0
Jun 11 '19 at 17:43 on
source share



All Articles