I just upgraded my Ubuntu from version 12.04 to 14.04, now with gedit 3.10. Previously I had managed to customize some shortkeys, e.g. block commenting to Ctrl+r and block uncomment to Ctrl+t (instead of the defaults Ctrl+m and Ctrl+Shift+m respectively). These settings did not survive the upgrade and I'm desperately trying to get them working again.

I've googled a lot on the issue, and the best I can find is listed below. I have run gconf-editor and checked the box "gnome->desktop->interface can_change_accels".

1) Close all running instances of gedit.

2) Open ~/.config/gedit/accels as root (with other editor than gedit, e.g. emacs).

3) Edit the relevant lines in the file, in my case (block commenting):

; (gtk_accel_path "<Actions>/GeditCodeCommentPluginActions/CodeComment" "<Primary>r")


; (gtk_accel_path "<Actions>/GeditCodeCommentPluginActions/CodeUncomment" "<Primary>t")

4) Save changes and close file.

If I look at the accels file (via e.g. the cat command), the changes are there. As soon as I open gedit however, the changes I made to accels are overwritten back to the defaults again. I found other posts with similar issues (the changes to accels are overwritten). Does anyone know of how to fix this to be able to customize the keyboard shortcuts?


1 Answer 1


A couple of things -

  1. you wouldn't edit ~/.config/gedit/accels as root, it's a user file. Typically any edit to an accels file would require removing the ; from line for it to hold. In the case of gedit doesn't matter, you can't successfully edit that file.

  2. To actually change just edit the plugin itself, open /usr/lib/x86_64-linux-gnu/gedit/plugins/codecomment.py in a root text editor for 64 bit install & change there. 32 bit is in i386-linux-gnu

(- at or about lines- 89 - 95, just change the letter(s), leave as <control>

  • Dear Doug, Thanks for your reply! This solution (changing the codecomment.py) worked perfectly and was just what I needed! Thanks!
    – Ida
    Commented Jun 22, 2015 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .