Last active
August 29, 2023 19:39
-
-
Save ccjmne/518f70633a5f92dfacb8b9040cc106ee to your computer and use it in GitHub Desktop.
AutoHotKey script for Unicode input, Ubuntu-like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Author: Eric NICOLAS (ccjmne) <ccjmne@gmail.com> | |
; Version: 1.2.3 | |
; Repository: https://gist.github.com/ccjmne/518f70633a5f92dfacb8b9040cc106ee | |
; Description | |
; =========== | |
; Input unicode characters with ease, the same way Ubuntu would enable you to. | |
; Ctrl-Shift-U, 2013, Enter and voilà, a beautiful en-dash for your value ranges :) | |
; Usage | |
; ----- | |
; 1. Initiate input w/ Ctrl-Shift-U | |
; 2. Input unicode code | |
; 3. Complete input with {Esc}, {Enter} or {NumpadEnter} | |
; - {Esc} cancels | |
; - {Enter} or {NumpadEnter} validates the input | |
; Automatic start-up | |
; ------------------ | |
; Use Ctrl-R and run 'shell:startup' to open your startup directory, then place this script there | |
#Requires AutoHotkey v2.0 | |
#SingleInstance Force | |
Echo(unused, char) { | |
SendInput char | |
} | |
Backspace(unused, vk, sc) { | |
SendInput Format('{vk{:x}sc{:x}}', vk, sc) | |
} | |
^+u:: { | |
SendInput 'U{+}' | |
hook := InputHook('', '{Esc}{Enter}{NumpadEnter}') | |
hook.KeyOpt '{Backspace}', 'N' | |
hook.OnChar := Echo ; Echo code being typed | |
hook.OnKeyDown := Backspace ; Also echo backspace (w/ KeyOpt: {Backspace}: N) | |
hook.Start(), hook.Wait() | |
SendInput '{BackSpace ' StrLen(hook.Input) + 2 '}' | |
if hook.EndKey != 'Escape' { | |
SendInput '{U+' hook.Input '}' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment