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…

I’m learning Scala

Being bored I was browsing Wikipedia, reading about languages that use Java’s VM. I was reading the Groovy article, thinking that it looked interesting enough to start learning it. But then I got to the end where Groovy’s author, James Strachan, said:

I can honestly say if someone had shown me the Programming in Scala book by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I’d probably have never created Groovy.
Groovy Criticism

If even Groovy’s author thinks there is a better language, I thought I should just skip it and go read up on Scala. So first I read Wikipedia’s article on Scala, then I went over to the Scala language site for more. What I read there looked interesting enough and I added the Eclipse update site to my Eclipse installation, downloaded some of the PDFs in the documentation section, and started to play around with it.
Read more of this post

Lua Userdata with user data

Sometimes I play around with Lua, and recently I decided it’s time to learn how to write modules in C/C++. I implemented a simple userdata with a few methods and property getter/setters. And while writing the Lua script to test the module, I noticed you could not set arbitrary properties on the userdata (of course not, it’s a userdata not a table). Then I started investigating, how this might be achived, yet every time I thought I had a solution it turned out it wouldn’t work, for some reason or other…

I was just about to give up, when I noticed a simple little paragraph in the Lua docs:

Pops a table from the stack and sets it as the new environment for the value at the given index. If the value at the given index is neither a function nor a thread nor a userdata, lua_setfenv returns 0. Otherwise it returns 1.


I knew about this function and its getter equivalent (lua_getfenv) but always assumed the “f” in the name stood for “function”. I have no idea what it might stand for, but once the implication of the emphasized part hit me, it became clear! Every userdata can have its own environment table! And with two simple metatable functions for “__index” and “__newindex”, this environment table can be exposed to the Lua side and user properties/methods could be set!

And just after I had it implemented, I found a page in the lua-users wiki where it shows how to do just that (although it is not the main focus on the page)… I hate when that happens. :-(

Favorite Monospace Font Ever!

Well, I have been using it exclusively for little over a year now, so I think it is time to declare Envy Code R my favorite mono spaced font.

Screenshot showing off font "Envy Code R"

Screenshot showing off font "Envy Code R"

Thanks, Damien!