Skip to content

Instantly share code, notes, and snippets.

@kbilsted
Last active March 14, 2019 07:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbilsted/d0393cad42c7ec0812e1 to your computer and use it in GitHub Desktop.
Save kbilsted/d0393cad42c7ec0812e1 to your computer and use it in GitHub Desktop.
A keyboard remapping making it easier to program with nordic (DK, SE, NO) Qwerty keyboard layouts
; To use this script first install http://www.autohotkey.com/
; ------------------------------------------------------------
;
; This script remaps your keyboard so it is more convenient to code
; while under the slavery of the nordic QWERTY mapping
;
; The script will do the following
; * Remap alt-j, alt-k. alt-l. alt-i to become cursor movements
; * Remap å and ¨ to imulate the nice position of []{} on US-QWERTY
; * Remap alt-h to be ";\n" since that is a very frequent sequence for C#. Java, C, ... programmers
;
; Enjoy
; - Kasper Graversen, 2015
; Remove this line if you want it to run in all apps
#IfWinActive, ahk_exe devenv.exe
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Easy access to [] and {}
; Using this script over switching to US-QWERTY is advantageous
; since you still want access to eg. CTRL-å
; And you need not have multiple keyboards that potentially gets activated
; in other applications than VS
å::Send [
¨::Send ]
+å::Send {{}
+¨::Send {}}
; return & semi-colon
!h::
Send {;}
Send {Return}
return
; extra cursor keys.
!j::
Send {Left down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Left up} ; Release the left-arrow key.
return
<^>!j::
Send {Left down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Left up} ; Release the left-arrow key.
return
!l::
Send {Right down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Right up} ; Release the left-arrow key.
return
<^>!l::
Send {Right down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Right up} ; Release the left-arrow key.
return
!i::
Send {Up down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Up up} ; Release the left-arrow key.
return
<^>!i::
Send {Up down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Up up} ; Release the left-arrow key.
return
!k::
Send {Down down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Down up} ; Release the left-arrow key.
return
<^>!k::
Send {Down down} ; Hold down the left-arrow key.
KeyWait a ; Wait for the user to release the key.
Send {Down up} ; Release the left-arrow key.
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment