Unbind/Rebind Ctrl+D in Gedit

After quite some googleing and experimenting I finally managed to change the behavior of Gedit and that annoying Ctrl+D shortcut. By default, pressing Ctrl+D deletes a line… very useful, I’m deleting lines all the time :roll-eyes:

To change this to something much more useful – like cutting the line and putting it into the clipboard – put the following into your ~/.gtkrc-2.0:

binding "override-ctrl-d" {
    bind "<ctrl>d" {
        "move-cursor" (display-line-ends, -1, 0)
        "move-cursor" (display-lines, 1, 1)
        "cut-clipboard" ()
    }
}
class "GeditView" binding :highest "override-ctrl-d"

To completely disable Ctrl+D, use the following instead:

binding "override-ctrl-d" {
    unbind "<ctrl>d"
}
class "GeditView" binding :highest "override-ctrl-d"

The important bit about these snippets is really just “class "GeditView" .... Now I just need to figure out how to remove the next useless key binding Ctrl+Shift+U…

Advertisements