DEV Community

loading...
Cover image for Javascript Operators with AutoHotKey

Javascript Operators with AutoHotKey

Camilo Martinez
['Family Man', 'Engineer', 'Software Developer', 'Metalhead', 'English Student' ]
Updated on ・1 min read

If you are a software developer and the major time write code in JavaScript (or TypeScript) this post can be useful.

With AutoHotKey you can remap some key behavior to write quick and easy all those operators used day to day.


You need to have installed AutoHotKey and create a file called js-remapkeys.ahk with this script.

#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.

!7::Send {&}{&}             ; Alt+7 -> &&
!9::Send {=}{>}             ; Alt+9 -> =>
!+9:: Send {(}{)}{ }{=}{>}  ; Shift+Alt+9 -> () =>
!\::Send {|}{|}             ; Alt+\ -> ||
!=:: Send {=}{=}{=}         ; Alt+= -> ===
!+=:: Send {!}{=}{=}        ; Shift+Alt -> !==
!+,:: Send {<}{=}           ; Shift+Alt+, -> <=
!+.:: Send {>}{=}           ; Shift+Alt+. -> >=
!.:: Send {?}{.}            ; Alt+. -> ?.
!+;:: Send {?}{:}           ; Shift+Alt+; -> ?:
!+/:: Send {?}{?}           ; Shift+Alt+/ -> ??
Enter fullscreen mode Exit fullscreen mode

Save the file and open it with AutoHotkey.

Finally, we will have a powered keyboard for JS/TS development.

js-keys


That’s All Folks!
Happy Coding 🖖

Buy me a coffee

Discussion (0)