Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Since I spend a lot of time on my laptop, I've gotten used to using keyboard shortcuts for everything. I want to be able to switch from tab to tab of opened documents in gedit by pressing Ctrl+Tab and Ctrl+Shift+Tab. Are there config files I can edit or something else I can do to enable this functionality?

Alternatively, can anyone post a lits of keyboard shortcuts in gedit?

share|improve this question
    
2  
I don't know why the hell anyone would think ctrl+alt+pageup/down was a sane shortcut for anything, especially tab switching. –  weberc2 Feb 28 '13 at 23:35
    
Yeah, I prefer my shortcuts to be mostly one-handed affairs. Control-Alt things I usually reserve for user- and system- related big tasks. –  WindowsEscapist Mar 1 '13 at 14:11
    
@weberc2 I use two-handed shortcuts for typing related tasks. That's where I use both hand while typing anyway. Only stuff where I will switch mouse and keyboard often need a single hand shortcut (like Copy-Paste). –  MadMike Nov 14 '13 at 9:27
    
@MadMike Unfortunately, I use gedit for reading more than writing. Usually I have some word file open in it. Regardless, page up/down keys aren't even in standard locations, and they're almost never on the same keyblock as your hands. If you have to move your hand to hit the page up/down keys, you may as well just move it a little further to the mouse. –  weberc2 Nov 14 '13 at 18:10
add comment

3 Answers

up vote 6 down vote accepted

There used to be an option to enable editable menu accelerators for GNOME apps. The GNOME team removed the GUI for this, but at least under GNOME 2 it was still available via gconf. Recent Ubuntu versions use GNOME 3; I'm not sure of whether that still works (since GNOME 3 has migrated to dconf). I tried it in the old gconf-editor, and setting the option /org/gnome/desktop/interface/can-change-accels using dconf-editor, but it doesn't seem to work in Gedit (v3.4 on Precise).

According to Where to configure shortcut keys of Nautilus?, it doesn't work with Unity's global menu. You could load a different desktop environment and make the change there (if it works).

It may still be possible to edit the keyboard shortcuts by editing configuration files. According to a commenter on the (very outdated) Gedit shortcuts documentation page:

You don't really need a plugin to change keyboard shortcuts. This (also) works:

~/.config/gedit/accels:

; gedit GtkAccelMap rc-file         -*- scheme -*-
(gtk_accel_path "<Actions>/GeditWindowActions/DocumentsPreviousDocument" "<Control>Page_Up")
(gtk_accel_path "<Actions>/GeditWindowActions/DocumentsNextDocument" "<Control>Page_Down")
(gtk_accel_path "<Actions>/GeditWindowActions/SearchFindPrevious" "<Shift>F3")
(gtk_accel_path "<Actions>/GeditWindowActions/SearchFindNext" "F3")

~/.config/gtk-3.0/gtk.css:

 @binding-set unbind-ctrl-d {
         unbind "<ctrl>d";
         unbind "<shift>F10";
         unbind "<ctrl>Page_Up";
         unbind "<ctrl>Page_Down";
 }
 GtkTreeView { gtk-key-bindings: unbind-ctrl-d; }
 GtkTextView { gtk-key-bindings: unbind-ctrl-d; }

According to one commenter, Ctrl-Tab is hardcoded and cannot be rebound easily, but there is a plugin that purports to do this. To install the plugin, see How do I install a plugin for gEdit v3?.

For gedit2, the plugin files go in ~/.gnome2/gedit/plugins.


If you're unable to get it to work, you could use a different editor that lets you edit shortcuts, such as KDE's Kate.

The list of default keyboard shortcuts in Gedit is available in the manual. Click "Help" > "Contents" > "Shortcut keys" in Gedit to access it.

share|improve this answer
    
Yes! Great answer! (Also great username XD) –  WindowsEscapist Nov 30 '12 at 21:24
    
The plugin is what I want; where do I put the decompressed tar? –  WindowsEscapist Nov 30 '12 at 21:41
1  
Never mind, found here –  WindowsEscapist Nov 30 '12 at 21:53
add comment

For Ubuntu 12.04 and up:

Use dconf-editor instead of gconf-editor

sudo apt-get install dconf-tools

Then set dconf>org>gnome>desktop>interface>can-change-accels to true

Setting shortcuts when using global menu (which is the case in Unity):

  1. Open evince (or any app) with UBUNTU_MENUPROXY=0 evince
  2. Browse menus, hover an entry, type your shortcut
share|improve this answer
    
Can you explain the Unity option more? gedit doesn't have a hover-able menu option so that one can set a custom shortcut with the unity method though. –  WindowsEscapist Nov 30 '12 at 21:50
    
In Unity, menus are in the top panel (previously named global menu) and you can't set your shortcuts with it. If it's the hover part you don't understand, 1. open gedit in terminal using UBUNTU_MENUPROXY=0 gedit, then go to the regular menu, place your mouse cursor on an entry, type your shortcut (eg Ctrl+x), then close gedit, done. –  user55822 Nov 30 '12 at 22:18
    
But in gedit, there is no entry to switch documents, only to go to a specific document. –  WindowsEscapist Dec 1 '12 at 0:48
    
Well nevermind .. there are Documents->Previous document and Documents -> Next entries, but ctrl+tab doesnt work, sorry. Ctrl+[twosuperior] does ... –  user55822 Dec 1 '12 at 9:22
add comment

At least for Lubuntu 13.10, you can edit .config/gtk-3.0/gtk.css, here's mine:

@binding-set unbind-ctrl-d {
        unbind "<ctrl>d";
        unbind "<shift>F10";
        unbind "<ctrl>Page_Up";
        unbind "<ctrl>Page_Down";
}
GtkTreeView { gtk-key-bindings: unbind-ctrl-d; }
GtkTextView { gtk-key-bindings: unbind-ctrl-d; }
share|improve this answer
    
I don't understand your answer. Maybe you could include a little explanation with your pasted config file? Without any further explanation, it looks like that all this does is remove some keyboard bindings. –  WindowsEscapist Nov 16 '13 at 22:33
    
@WindowsEscapist It's exactly what it looks like, simply remove some gtk keyboard bindings, including <ctrl>d, which interferes with gedit's ones. –  RubenCaro Nov 23 '13 at 8:03
    
So you remove these bindings to allow a binding of Ctrl+Tab, etc? I'm not very familiar with editing bindings as a whole, so it would be nice if you could add a bit of explanation - why does this work? Maybe not an ELI5, but an ELI7. Sorry. (Upvoted anyway, thanks for the answer!) –  WindowsEscapist Nov 26 '13 at 23:40
    
@WindowsEscapist It's just removing these four bindings that bother for some apps. The one you are interested is <ctrl>d. If you do not want to unbind <shift>F10 simply remove its unbind line. And so on... –  RubenCaro Dec 27 '13 at 19:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.