Skip to content

Instantly share code, notes, and snippets.

@DamianStanger
Last active March 29, 2016 09:13
Show Gist options
  • Save DamianStanger/661cb9df896c407ddc25 to your computer and use it in GitHub Desktop.
Save DamianStanger/661cb9df896c407ddc25 to your computer and use it in GitHub Desktop.
Auto hot key, Vim style edit mode
; + = shift
; ^ = ctrl
; # = windows
; ! = alt
::pw1::password1
; #v::Run "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
^+Down::send ^{End}
^+Up::send ^{Home}
#!Right::send {End}
#!Left::send {Home}
#!Up::send {PgUp}
#!Down::send {PgDn}
+#Right::send +{End}
+#Left::send +{Home}
+#Up::send +{PgUp}
+#Down::send +{PgDn}
^#Right::send {Home}+{End}
^#Left::send {End}{Space}{Home}+{End}{Del}+{Home}{Del}{Home}
;^#Up::
^#Down::SendInput,{Home}{Home}+{End}+{End}^c{End}{Enter}+{Home}^v
#enter::Send,{End}{enter}
+enter::Send,{Home}{enter}{Up}
#space::Send,{space}{left}
#w::Send,^{Right}^+{Left}
#j::Send,{End}{Del}
; #IfWinActive ahk_class Notepad
; ::btw::This replacement text will appear only in Notepad.
; #IfWinActive
; ::btw::This replacement text appears in windows other than Notepad.
; RAlt::Return ; Disable right Alt Gr
; >!a::Send {Left}
; >!d::Send {Right}
; RAlt & a::Left
; >^::Return ; Disable right control
; >^s::Send {Left}
; >^f::Send {Right}
; >^e::Send {Up}
; >^d::Send {Down}
; #IfWinActive ahk_class Word
; ^+z::Send,^y ; map ctr shift z to ctr y in msword
;Stop capslock & key from toggling capslock.
;+Capslock::Capslock ; shift capslock to turn on caps lock
;capslock::
;*capslock::
;#If GetKeyState("CapsLock", "T")
; down::down
; up::up
; right::right
; left::left
; appskey::
; tab::Send,{Home}{tab}
; space::Send,{space}{left}
; enter::Send,{End}{enter}
; insert::Send,{Home}{enter}{Up}
; Backspace::Send,{Backspace}
;
; 1::
; 2::
; 3::
; 4::
; 5::
; 6::
; 7::
; 8::
; 9::
; 0::
;
; `::
; -::
; =::
; [::
; ]::
; `;::Send,{Del}
; '::
; #::
; ,::
; .::
; \::
;
; q::SendInput,{Home}{Home}+{End}+{End}
; w::Send,^{Right}^+{Left}
; e::SendInput,_{Home}{Home}+{End}+{End}{Del}{Del} ; _ need a place holder if the line is empty
; r::
; t::
; y::Send,{PgUp}
; u::Send,{PgUp}
; i::Send,{Up}
; o::Send,{Home}
; p::Send,{End}
; a::SendInput,_{Home}{Home}+{End}+{End}{Del}{Del}
; s::Send,^{Right}^+{Left}{Del}
; d::SendInput,{Home}{Home}+{End}+{End}^c{End}{Enter}+{Home}^v
; f::
; g::
; h::Send,{Backspace}
; j::Send,{Left}
; k::Send,{Down}
; l::Send,{Right}
; z::Send,^z
; x::Send,^x
; c::Send,^c
; v::Send,^v
; b::
; n::Send,{PgDn}
; m::Send,{PgDn}
;#If
;#IfWinActive ahk_class PowerShell_ISE AND GetKeyState("CapsLock", "T")
;{
; /::SendInput,{Home}{Home}{#}{Home}{Down}
;}
;#IfWinNotActive, Notepad AND GetKeyState("CapsLock", "T")
;{
; /::Send,{Home}{Home}//{Home}{Down}
;}
;-----------------------------------------------------------***
;### Search Google for selection, or open URL ###
;browser="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
#g:: Run % "http://www.google.co.uk/search?q=" . GetSelectedText()
GetSelectedText() {
tmp = %ClipboardAll% ; save clipboard
Clipboard := "" ; clear clipboard
Send, ^c ; simulate Ctrl+C (=selection in clipboard)
ClipWait, 1 ; wait until clipboard contains data
selection = %Clipboard% ; save the content of the clipboard
;selection := RegExReplace(RegExReplace(selection, "\r?\n"," "), "\s+","+") ;Trim
Clipboard = %tmp% ; restore old content of the clipboard
return (selection = "" ? Clipboard : selection)
}
;-----------------------------------------------------------***
; surrounds selection with { }
#+[::
Send ^c
Sleep 100
clipboard = {%clipboard%}
Send ^v
return
;-----------------------------------------------------------***
; surrounds selection with [ ]
#[::
Send ^c
Sleep 100
clipboard = [%clipboard%]
Send ^v
return
;-----------------------------------------------------------***
; surrounds selection with ( )
#9::
Send ^c
Sleep 100
clipboard = (%clipboard%)
Send ^v
return
;-----------------------------------------------------------***
; surrounds selection with " "
#2::
Send ^c
Sleep 100
clipboard = "%clipboard%"
Send ^v
return
;-----------------------------------------------------------***
; surrounds selection with ' '
#'::
Send ^c
Sleep 100
clipboard = '%clipboard%'
Send ^v
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment