Saturday, February 4, 2017

remapping - Getting some French-Canadian keyboard strokes to work on English keyboard


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 < '

Answer



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

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...