Custom keyboard shortcuts in gedit

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.


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

I have written a plugin for Gedit 3.30 and later (included in Ubuntu 18 and later) which adds some common keyboard shortcuts.

Ctrl+Tab / Ctrl+Shift+Tab for navigating between documents
Ctrl+Y for Redo
Ctrl+G for Go to line
Ctrl+E for Delete line(s)

(And it is fairly straightforward to modify the plugin to change the key combinations for these operations.)

https://github.com/foolo/gedit_custom_keys/

Just copy the files to the gedit plugin directory.