Damo
Damo

Reputation: 6433

Creating Vim like functionality with AutoHotKey (AHK)

I've been using autoHotKeyrecently on a windows 8 machine and loving it. But I want to be able to press caps lock and turn the keyboard into a vim like command mode for moving the cursor, inserting and deleting easily in any program.

UPDATE (Thanks to @MCL for the help so far)

Im trying to use the following script but it wont change the behaviour based on the state

state := GetKeyState("Capslock", "T") 
if state
  j::Send,{Left}
  l::Send,{Right}
  i::Send,{Up}
  k::Send,{Down}
return

Upvotes: 3

Views: 2565

Answers (1)

fxam
fxam

Reputation: 3982

Create context-sensitive hotkeys with #If:

#If GetKeyState("CapsLock", "T")=1

; The following hotkeys will only be effective if GetKeyState("CapsLock", "T")=1
j::Send,{Left}
l::Send,{Right}
i::Send,{Up}
k::Send,{Down}

#If ; end of #If

Upvotes: 6

Related Questions