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.

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 )

share|improve this question
    
Have you looked through GConf? –  Scott Severance Apr 21 '11 at 13:24

2 Answers 2

up vote 2 down vote accepted

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... 
#
share|improve this answer

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
share|improve this answer

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.