In Gedit, I installed the line_tools plugin. It uses Ctrl+D to duplicate the the current line. When I pressed Ctrl+D, it did the opposite! It deleted the line instead!

It turns out that Gedit has an unlisted (not in the menu) shortcut-key: Ctrl+D, which deletes a line.

It is quite simple to change any menu item's shortcut-key in Gedit by enabling Editable Menu Accelerators, but I can't change this delete-line action's key, because there is no menu item for it!

How can I override this delete-line action? .. and what other unlisted actions does Gedit have? .. and why is it (they?) unlisted?

PS: The developer of the 'line_tools' provides the plugin with Ctrl+D set to 'Duplicate'.. I assume he tested it; which would suggest that there was no such clash circa 2008-01-30 (the timestamp on the downloaded line_tools.py )


I like the idea to do a binary edit. However the process described above seems too cumbersome.

Here is a much simpler and more reliable way:

sudo sed -i "s/delete_from_cursor/_elete_from_cursor/g" /usr/bin/gedit

I've found a workaround for this particular Ctrl+D shortcut...

It was interesting to see that most on the site where I found it have been a Notepad++ users (me too :), where Ctrl+D was the "delete-line" shortcut...

The "fix" involves a simple mod to the 'gedit' binary... It changes one byte of a name, so that the shortcut reference becomes invalid...
This frees-up the Ctrl+D shortcut, and allows the plugin to function normally, and the new Ctrl+D menu-item is editable.

The only side-effect appears to be that a "Warning" is issued, which you can see if you start 'gedit' from the terminal...
Because this is a "hack" (in the roughest sense of the word), it is possible that there could be other side-effects, eg. maybe something doesn't get cleaned up properly... but I'll be using it...

Here is the 2-minute hack:
(The fix will need to be re-applied when gedit is updated)

# Make a backup of 'gedit' binary
sudo cp /usr/bin/gedit{,.before-ctrl+d-hack} 

# Hexedit the 'gedit' binary ...(I've used 'ghex2`)
gksu ghex2 /usr/bin/gedit

# In 'ghex2' 
#     Find the string: delete_from_cursor
#     Replace it with: #elete_from_cursor
# Save the binary, and exit... 
  • Even if that sound interesting, i don't know why you didn't install with Wine. Anyway, i wanna hack gedit too to get rid of Ctrl+Destroyer shortkey. Thank you. – erm3nda May 26 '15 at 4:00
  • (The fix will need to be re-applied when gedit is updated) . Seems what you really like is the sed command from @Stephen Boesch – erm3nda May 26 '15 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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