When using Windows XP at work, I have customized the keyboard layout to almost match my setup on Gentoo — important when you code lines and lines of Java…

In addition to my modified Colemak keyboard layout created by the Microsoft Keyboard Layout Creater, I use scancodes to remap special keys, which is not possible in MKLC.

My current setup is this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,08,00,00,00,01,00,3a,00,3a,00,01,00,19,00,46,00,0e,00,19,00,2a,00,56,00,38,00,38,e0,38,e0,2a,00,00,00,00,00

Note: Be careful when pasting stuff like this into your registry — you have been warned πŸ™‚

The scancode mapping does the following:

  • Swaps Escape and Caps Lock.
  • Makes QWERTY P an extra Backspace key.
    Remember, Colemak has the semicolon on QWERTY P’s position. This makes it possible to delete
  • Makes P available on Scroll Lock.
    A pragmatic backup key for P when using other layouts than Colemak. For instance, some virtual machines read raw input from the keyboard, but the scancode map still applies.
  • Moves Left Shift to Less Than (at the right of Left Shift on pc-105 keyboards).
    This eases the strain on the left little finger.
  • Copies Left Alt to Alt-Gr.
    This way, you can use both hands for the Alt modifier, which greatly reduces the strain on the hands. Generally, use the one hand for the key and the other hand for the modifier.
  • Moves Alt-Gr to the original position of Left Shift.
    Takes a little to get used to, but very handy when defining custom keybindings.

The format of the scancode map is pretty simple:

00,00,00,00, <- preamble
08,00,00,00, <- number of remaining 4-tuples (end-sequence inclusive)
01,00,3a,00, <- swap Escape and Caps Lock
00,00,00,00  <- end-sequence

You can find more information on the scancode map format here, and a scan code reference here. Have fun…

My just-as-tool-minded friend has created a blog at esbena.blogspot.com, which you might be interested in. He has some nice setup for Emacs and Eclipse, and is the creator of screencast-mode. Oh, and getting a new rival blog made me put myself together and update my blog πŸ™‚

One of the most useful features in Zsh is its support for user-defined widgets. These two commands will greatly speed up your directory navigation in Zsh:

setopt autopushd

go-up () {
cd ..
zle reset-prompt
}; zle -N go-up

go-to-previous () {
zle reset-prompt
}; zle -N go-to-previous

bindkey '^[u' go-up
bindkey '^[p' go-to-previous

Now you can go up one level with Alt-U and go backwards in history with Alt-P. Also, this won’t clutter your terminal with “cd ..” lines, as the prompt line gets automagically updated. Similarly, you can add bookmark-like functionality with something like this:

typeset -Ag bookmark


go-to-bookmark () {
cd $bookmark[$KEYS[-1]]
zle reset-prompt
}; zle -N go-to-bookmark

bindkey '^[0' go-to-bookmark
bindkey '^[1' go-to-bookmark
bindkey '^[2' go-to-bookmark
bindkey '^[3' go-to-bookmark
bindkey '^[4' go-to-bookmark
bindkey '^[5' go-to-bookmark
bindkey '^[6' go-to-bookmark
bindkey '^[7' go-to-bookmark
bindkey '^[8' go-to-bookmark
bindkey '^[9' go-to-bookmark

Have fun!

I have been using XMonad for about a year now and have finally put myself together to upload my customizations. Highlights:

  • Labeled pager addon for DynamicLog
  • Fast navigation between workspaces
  • Application specific border colors
  • Modified Scratchpad using GNU Screen
  • Host specific settings (layouts and widgets)

To use these modules, you must put them in ~/.xmonad and then reenable support for user modules in your xmonad source.Β Simply look for a line in Core.hs containing runProces “ghc” [“–make”, “xmonad.hs” …] and remove the “-i” entry from the list. This switch was unfortunately added to fix a bug on case insensitive file systems. Note that a solution is under development, placing user modules in ~/.xmonad/lib, thus solving the issue with case insensitive systems, see issue 230.


I will try to make some darcs patches for xmonad-contrib if I get time. Until then, I hope you can get inspired by some of my ideas. Enjoy πŸ™‚

I like to be able to find the next occurence of a string without exiting the command line. Here is a hack to do that:

set incsearch
cnoremap <expr> / (getcmdtype() == '/' || getcmdtype() == '?' ? (getcmdline() == '' ? "<Up>" : "<Cr>/<Up>") : "/")
cnoremap <expr> ? (getcmdtype() == '/' || getcmdtype() == '?' ? (getcmdline() == '' ? "<Up>" : "<Cr>?<Up>") : "?")

Here is my Vim configuration as of May 2009. It is a work in progress (and will always be), and is designed on a number of pragmatical choices and compromises, rather than on a universal guideline.

That been said, I think my configuration has become pretty neat. See for yourself πŸ™‚

I only use Vim in the terminal, but most of the configuration also works in gVim (you may have to modify some of the bindings for the special characters like <C-Space>).

Although the .vimrc is long, I have tried to avoid making the configuration too heavy, so you will only find mappings that I actually use. Usually, I discover a work pattern that I want to speed up, and create a binding. Then I try it some time to see if I will get used to it; if not, I remove again. That’s the methodology πŸ™‚

Major features

  • Usable with both the Colemak and Qwerty layout
  • Readable colorscheme
  • Makes heavy use of alt/meta bindings (as alt is easier to hit than control)
  • Efficient tabbed navigation
  • Custom status line
  • Quick access to often used Ex commands
  • Many navigation improving bindings (examples: next occurence of visual selection, tag jump in new tab reusing existing tabs, search outline ({{{), open visual selection in split window)
  • Plugins are configured to be pervasive (they will not get in your way; at least not my way πŸ™‚ )

As of writing, I use these external plugins, which you may download from vim.org.

  • AlignPlugin
  • NERD_commenter
  • a (alternate)
  • imaps
  • matchit
  • project
  • rhs (not yet published)
  • securemodelines
  • surround
  • taglist
  • timestamp
  • vcssvn

Of “major” filetype plugins, I use haskellmode and latexsuite.

These are the files of interest. Enjoy πŸ™‚

I recently switched to the amazing colemak keyboard layoutΒ  – well, read the FAQ.

Also, being Danish (and using Vim), I swapped J and Y (qwerty Y and O). Qwerty Y is the only button I have difficulties reaching, and Danish has many “hard to reach” combinations like SKJ. I use AltGr for the Danish characters, Γ†, Ø, and Γ….

Further, by swapping J and Y, the mappings works well in Vim without any remapping (which breaks the consistency). Instead of HJKL I use HONU (qwerty positions), which are fairly easy to reach. It takes quite some time to get used to (especially for Vimmers), but I think it’s worth it…

Update: New version available. It is ported to native Vim Script, and support has been added for wildcards in &path. Download. Add the file to your .vimrc, or fit it in as a plugin.

On March 27, 2008:

When you use the normal gf and <C-]> bindings, you change the buffer in the current window. There is also an option to create a new window when doing it, but there are no way to reuse windows that already show the corresponding buffer, at least not natively.

You can reuse tabs and windows (like other IDE’s) with findtab.py, which is a simple Python script consisting of three functions. To use it, add something like the following to your .vimrc:

pyfile ~/.vim/extern/findtab.py
nnoremap <M-]> :python TabTag()<Cr>
nnoremap <C-w><M-f> :python TabFile()<Cr>

I have tried to make TabFile() work like gf, supporting path, includeexpr and suffixesadd. I think TabTag() works like <C-]>. The script also supplies a general Python function called FindTag(filename). It works as you think…

I have put myself together and cleaned up my Fvwm config to make it shareable:


It is a 100 % keyboard driven Fvwm config, that aims to make window handling efficient by making the keyboard commands easy to hit. Two instances of conky (one is double buffered, the other in its own window) and xfce4-panel is visible in the screenshots.

All window handling uses the AltGr (right Alt on the US keyboard) key as modifier, to avoid conflicts with applications. AltGr is easy to reach, but seldom used, except for “local characters”. The most frequently used commands are the easiest to hit. For example, instead of using CTRL-F1,F2,F3,F4 to switch workspace, AltGr-U,I,O,P is used instead. The “root menu” is called with AltGr-L.

The window titlebar is replaced by a colored border; the color which depends on the application. This actually improves the readability (IMHO), as the “real” information comes closer to each other. Also it uses less screen space which is crucial on a 12″ laptop πŸ™‚

Also, I found a copy of my original Fvwm config from 2005, so it’s available for download again, thanks to the guys at guistyles.com. The link at the post had been broken for a while.

It is possible to customize the behavior of cindent in Vim by writing a wrapper function. All you need is to find out which indentifiers Vim uses for calculating the new indent, and then find an appropriate regular expression.

Suppose we do not want to indent stuff in namespace declarations. I found out that it is enough to adjust the indentation of the first definition (except for a special case when using inheritance (“: public …“), see the code): continue reading…