Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use some of the French-Canadian keyboard stokes I'm used to on an English keyboard. I would like to change the behaviour of some keys. I was able to implement these changes in Vim, but I would like them to be applied system-wide (for Windows and Ubuntu).

Here's what I want to implement :

  • If I press [a, the character printed is â.

  • When I press [r, something that's supposed to stay normal, the characters printed are [r.

  • If I hold [ for 3 seconds, [ is printed. I want this delay to be applied to all my modified keys.

  • I want to map < to ' and the characters 'e to è.

    The complex problem here is that I only want the ' beside the ; key to produce the è character, NOT when I press the < (remapped to ') then e.

I'll show you a .vimrc file that implements this, now I want this behavior system-wide:

set timeout timeoutlen=3000 ttimeoutlen=100
inoremap [a â
inoremap [A Â
inoremap [e ê
inoremap [E Ê
inoremap [i î
inoremap [I Î
inoremap [o ô
inoremap [O Ô
inoremap [u û
inoremap [U Û

inoremap 'a à
inoremap 'A À
inoremap 'e è
inoremap 'E È
inoremap 'u ù
inoremap 'U Ù

inoremap }e ë
inoremap }E Ë
inoremap }i ï
inoremap }I Ï
inoremap }u ü
inoremap }U Ü

inoremap ]c ç
inoremap ]C Ç
inoremap / é
inoremap < '
share|improve this question
    
Why not simply switch to a fr-CA keyboard? – kinokijuf Aug 22 '12 at 5:24
1  
I find the English keyboard to be easier to use for keys like [, {, ", @, etc. when I'm writing code for example. I always need to erase because I didn't switch keyboard and it's frustrating. – Gradient Aug 22 '12 at 5:38
    
Aren’t French letters available on the US-international keyboard? – kinokijuf Aug 22 '12 at 7:19
    
Yes, I thought about that but accents are not at the same place as on a French-Canadian keyboard. They're even very hard to type fast. Example : à is typed with `, then a. You can't keep a good typing flow if you have to type those two characters. – Gradient Aug 22 '12 at 7:52
1  
up vote 3 down vote accepted

AutoHotKey, mentioned by harrymc, was the solution.

Here is a part of the AutoHotKey code that solves my specific problem. Missing letters can be easily added.

StringCaseSense On

; circumflex accents
$[::
Send [
Input, Char, T2 L1, {delete}{esc}{home}{end}
if Char = a
{
    Send {backspace}â
    return
}
Send %Char%
return

; grave accents
$'::
Send '
Input, Char, T2 L1, {delete}{esc}{home}{end}
if Char = a
{
    Send {backspace}à
    return
}
Send %Char%
return

; trema
+]::
Send {}}
Input, Char, T2 L1, {delete}{esc}{home}{end}
if Char = e
{
    Send {backspace}ë
    return
}
Send %Char%
return

; cedilla
$]::
Send ]
Input, Char, T2 L1, {delete}{esc}{home}{end}
if Char = c
{
    Send {backspace}ç
    return
}
Send %Char%
return

; other fixes
$<::
Send '
Input, Char, T2 L1, {delete}{esc}{home}{end}
if Char =
{
    Send {backspace}<
    return
}
Send %Char%
return

$/::
Send é
Input, Char, T2 L1, {delete}{esc}{home}{end}
if (Char = "")
{
    Send {backspace}/
    return
}
Send %Char%
return

$?::
Send É
Input, Char, T2 L1, {delete}{esc}{home}{end}
if (Char = "")
{
    Send {backspace}?
    return
}
Send %Char%
return
share|improve this answer
    
Nice work. You should have gotten the bounty because you actually showed how to implement it by providing an actual script instead of just a generic, figure-it-out-for-yourself link. I was going to write a script like this, but you already had it done. +1 – Synetech Sep 10 '12 at 17:44

AutoHotkey (AHK) can do all of this and much more, but is only available for Windows, which is where I have experience with this wonderful macro recorder that has grown into a complete programming environment.

For Linux, there is a cross platform version that runs AHK on Linux under .NET or MONO: IronAHK, but I have no experience with it.

The article Install IronAHK on Linux might be useful.

share|improve this answer
    
Nice to hear there's an AHK for Linux. – Tom Wijsman Sep 9 '12 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .