; Important info about Getting Started: lines that start with
; Semicolon, such as this one, are comments. They are not executed.
; This script has a special filename and path because it is automatically
; Launched when you run the program directly. Also, any text file whose
; Name ends in. Ahk is associated with the program, which means that it
; Can be launched simply by double-clicking it. you can have as login. Ahk
; Files as you want, located in any folder. You can also run more
One Ahk file simultaneously and each will get its own tray icon.
; Sample hotkeys: below are two sample hotkeys. The first is win + Z and it
; Launches a web site in the default browser. The second is Control + ALT + n
; And it launches a new notepad window (or activates an existing one).
; Try out these hotkeys, run autohotkey again, which will load this file.
; # Z: Run www.autohotkey.com
; # Ifwinactive Emacs @ acernt61; if in Emacs
; + Capslock: capslock; make shift + caps-lock the Caps Lock toggle
; Capslock: control; Make Caps Lock the control button
; Lalt: lcontrol
; Lcontrol: lalt
; # Ifwinactive; end if in Emacs
; Lalt: lcontrol
; Lcontrol: lalt
^ ESC: Reload
! [: Suspend
+ ESC: Edit
; Not for the Emacs
# Ifwinnotactive, emacs @ acernt61
{
; ^! N ::
; If winexist untitled-Notepad
; Ifwinexist, untitled-Notepad,
; Winactivate
; Else
; Run calc
; Return
;
^ J ::
Send {enter}
Return
^ H ::
Send {backspace}
Return
; ^ P ::
; Send {up}
; Return
;;
; ^ N ::
; Send {down}
; Return
; ^ ::
; Send {home}
; Return
;;
; ^ + ::
; Send {shift down} {home} {shift up}
; Return
;;
; ^ E ::
; Send {end}
; Return
;;
; ^ + E ::
; Send {shift down} {end} {shift up}
; Return
; Ifwinnotactive, pas-Microsoft Visual Studio
;;{
; ^ F ::
; Send {right}
; Send {left}
; Return
;;
;;}
; ^ B ::
; Ifwinnotactive, visual
; Ifwinactive, pas
;{
; Send {left}
; Return
;}
; Else
;;;{
; Send {control} {B}
; Return
;;;}
; Return
; Note: From now on whenever you run autohotkey directly, this script
; Will be loaded. So feel free to mimize it to suit your needs.
; Please read the quick-start tutorial near the top of the Help file.
; It explains how to perform common automation tasks such as sending
; Keystrokes and mouse clicks. It also explains more about hotkeys.
; Ifwinactive, youdao dictionary-auroran
;;{
^! I ::
; Run notepad
; Run, E: \ Program Files \ youdao \ dict54 \ yodaodict.exe
; Winwait, youdao dictionary,
Ifwinnotactive, youdao dictionary, winactivate, youdao dictionary,
; Winwaitactive, youdao dictionary,
; Winmaximize
; Mousegetpos ox, oy
; Mousemove, % ox %, % Oy %, 0,
; Mouseclick, left
Mouseclick, left, 130, 95
Mousemove, 110,90
; Sleep, 100
; Coordmode pixel; interprets the coordinates below as relative to the screen rather than the active window.
; Imagesearch, foundx, foundy, 100, 75,600,100 0, E: \ Program Files \ youdao \ dict54 \ 5.4.42.2682 \ skins \ default.png
; If errorlevel = 2
; Msgbox cocould not conducting the search.
; Else if errorlevel = 1
; Msgbox icon cocould not be found on the screen.
; Else
; Msgbox the icon was found at % foundx % x % foundy %.
;
; Mouseclick, left, 188, 96
; Mouseclicking, right, 188, 96
; Sleep, 100
Return
; Winwait, youdao dictionary,
Ifwinnotactive, youdao dictionary, winactivate, youdao dictionary,
; Winwaitactive, youdao dictionary,
; Mouseclick, left, 249, 96
; Sleep, 100
;;}
; ^ L ::
; Tmpfile = % a_scriptdir % \ ahk_text_edit_in_vim.txt
; Gvim = E: \ Vim \ vim73 \ gvim.exe
; Wingettitle, active_title,
; Clipboard =
; Clear the clipboard
; Send ^
; Send Ctrl + A to select all text
; Send ^ C
; Send Ctrl + C copy
; Clipwait
; Wait for the data to enter the clipboard
; Filedelete, % tmpfile %
; Fileappend, % clipboard %, % tmpfile %
; Runwait, % gvim % "% tmpfile %" +
; Fileread, text, % tmpfile %
; Clipboard: = text
; Restore the read data to the clipboard
; Winwait % active_title %
; Wait for the window to activate the text just now
; Send ^ V
; Send Ctrl + V Paste
; Return
; Modal_vim.ahk
; Initial build: Rich Alesi
; Friday, May 29,200 9
;;
; Modified for ahk_l by Andrej Mitrovic
; Version 0.3
; August 12,201 0
;
; Globals
; Inputnumber: = ""
; Modal = 0
; Shift_mode = 0
;
; Unvimize ()
;
; # Singleinstance force
; # Maxhotkeysperinterval 800000
; # Notrayicon
; Setwindelay, 0
; Coordmode, mouse
; # Persistent
; Setkeydelay,-1
; Coordmode, tooltip, screen
;
; ^! Home: exitapp
;
; Close, edit script
; # If (edit_script = 0)
; ^! Home ::
; Wingetactivetitle, atitle
; Wingetclass, class, % atitle %
; If (class! = "Irfanview ")
;;{
; Run, scite "G: \ Documents and Settings \ Andrej \ Desktop \ Ahk scripts \ vim_mode.ahk"
; Exitapp
;;}
; Return
; # If
;
; Gui
; Y (text, time = 0)
;{
; If (text = "")
;{
; Progress, off
; Return
;}
;
; Progress, y989 B2 fs10 zh0 w150 ws700, % text %, verdana
; If (time! = 0)
;{
; Sleep, % time %
; Progress, off
;}
; Return
;}
;
; Number-normalizer, do not allow more than X ammount of digits
; Normalize (reset_number)
;{
; Global inputnumber
; If (inputnumber> 500)
;{
; Inputnumber: = reset_number
;}
;}
;
; Mode-switch key
; Capslock ::
;{
; If (modal = 0)
;{
; Vimize ()
; Y ("Vim mode", 400)
;}
; Else
;{
; Unvimize ()
; Y ("insert mode", 400)
;}
; Return
;}
;
; Mode-switch and cleanup Functions
; Vimize (); enter Vim Mode
;{
; Global
; Modal: = true
; Resetgui ()
; Return
;}
;
; Unvimize (); exit Vim mode, do cleanup
;{
; Global
; Modal: = false
; Resetgui ()
; Resetinputnumber ()
; Return
;}
;
; Resetinputnumber ()
;{
; Global
; Resetgui ()
; Inputnumber: = ""
;}
;
; Resetgui ()
;{
; Progress, off
;}
;
; Sc029 ::
;{
; If (modal = true)
;{
; Return; early exit, shift_mode can't be used while in VIM Mode
;}
;
; If (shift_mode = 0)
;{
; Shift_mode = 1
; Return
;}
; Else
;{
; Shift_mode = 0
; Return
;}
; Return
;}
;
;;;;! @ # $ Shift_mode works only when not in modal Mode
; # If (shift_mode = true)
;
; $1 ::!
; $2 ::@
; $3 ::#
; $4: $
; $5: Send '%
; $6: Send {^}
; $7: Send {&}
; $8: Send {*}
; $9 ::(
; $0 ::)
;
; Sc028: Send ,{"}
;
; # If
;
;
; VIM Mode
; # If (modal = true)
;
; ESC:; reset input number and any commands
;{
; Inputnumber: = ""
; Progress, off
; Return
;}
;
; The following allows appending numbers before a command,
; E.g. 2, 4, W = 24 W which can then be used throughout the rest of the commands.
; The number is usually reset to 0 by a move/modify command or ESC.
; $0 ::
;{
; If (inputnumber <1)
;{
; Return; putting 0 in first place does not make sense
;}
;
; Inputnumber = % inputnumber % 0
; Normalize ("")
; Y (inputnumber)
; Return
;}
;
; $1 ::
;{
; Inputnumber = % inputnumber % 1
; Normalize (1)
; Y (inputnumber)
; Return
;}
;
; $2 ::
;{
; Inputnumber = % inputnumber % 2
; Normalize (2)
; Y (inputnumber)
; Return
;}
;
; $3 ::
;{
; Inputnumber = % inputnumber % 3
; Normalize (3)
; Y (inputnumber)
; Return
;}
;
; $4 ::
;{
; Inputnumber = % inputnumber % 4
; Normalize (4)
; Y (inputnumber)
; Return
;}
;
; $5 ::
;{
; Inputnumber = % inputnumber % 5
; Normalize (5)
; Y (inputnumber)
; Return
;}
;
; $6 ::
;{
; Inputnumber = % inputnumber % 6
; Normalize (6)
; Y (inputnumber)
; Return
;}
;
; $7 ::
;{
; Inputnumber = % inputnumber % 7
; Normalize (7)
; Y (inputnumber)
; Return
;}
;
; $8 ::
;{
; Inputnumber = % inputnumber % 8
; Normalize (8)
; Y (inputnumber)
; Return
;}
;
; $9 ::
;{
; Inputnumber = % inputnumber % 9
; Normalize (9)
; Y (inputnumber)
; Return
;}
;
;
; Navigation
; J ::
;{
; Send, {left % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; L ::
;{
; Send, {right % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; I ::
;{
; Send, {up % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; K ::
;{
; Send, {down % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; ^ I ::
;{
; Send, {pgup}
; Return
;}
;
; ^ K ::
;{
; Send, {pgdn}
; Return
;}
;
; Sc027: Send, {enter}
; A: Send, {home}
; E: Send, {end}
;
; W:; move # Words forward
;{
; Send, ^ {right % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; B:; move # words back
;{
; Send, ^ {left % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; [:; Set cursor to previous block
;{
; Send, ^ [
; Return
;}
;
;]:; Set cursor to next block
;{
; Send, ^]
; Return
;}
;
; G:; go to # line number
;{
; Send, ^ g % inputnumber % {enter}
; Resetinputnumber ()
; Return
;}
;
; Selections
; + I:; select up
;{
; Send, {shift down} {up % inputnumber %} {shift up}
; Resetinputnumber ()
; Return
;}
;
; + K:; select down
;{
; Send, {shift down} {down % inputnumber %} {shift up}
; Resetinputnumber ()
; Return
;}
;
; + J:; select left
;{
; Send, {shift down} {left % inputnumber %} {shift up}
; Resetinputnumber ()
; Return
;}
;
; + L:; select right
;{
; Send, {shift down} {right % inputnumber %} {shift up}
; Resetinputnumber ()
; Return
;}
;
; ^ + I:; Select page up
;{
; Send, {shift down} {pgup} {shift up}
; Return
;}
;
; ^ + K:; Select page down
;{
; Send, {shift down} {pgdn} {shift up}
; Return
;}
;
; + W:; select # Next word
;{
; Send, + ^ {right % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; + B:; select # previous words
;{
; Send, + ^ {left % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; + [:; Select to previous block
;{
; Send, {CTRL down} {shift down} [{CTRL up} {shift up}
; Return
;}
;
; +]:; Select to next block
;{
; Send, {CTRL down} {shift down}] {CTRL up} {shift up}
; Return
;}
;
; Search & replace
;/:; Search
;{
; Send, ^ F; call the Search dialog
; Unvimize (); Switch to insert mode
; Keywait, enter, D; enter exits Search dialog
; Vimize (); return back to VIM Mode
; Return
;}
;
; ^/:; Replace
;{
; Send, ^ h; call the replace Dialog
; Unvimize (); Switch to insert mode
; Keywait, ESC, D; ESC exits replace Dialog
; Vimize (); return back to VIM Mode
; Return
;}
;
; N: Send {F3}; Search next
; + N: Send + {F3}; Search previous
;
;
; Editing
; $ C:; copy Selection
;{
; Send ^ C
; Y ("selection copied.", 1000)
; Return
;}
;
; F:; Delete # characters
;{
; Send, {backspace % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; D:; backspace Delete # characters
;{
; Send, {Delete % inputnumber %}
; Resetinputnumber ()
; Return
;}
;
; Q:; comment a line or selected lines
;{
; Send, ^ Q
; Return
;}
;
; U: Send, ^ Z; undo
; Y: Send, ^ y; Redo
;
; ^ U:; reopen last closed file
;{
; Send, {alt down} f {1} {alt up}
; Return
;}
;
;: * C: WD ::;; Delete # Words
;;{
; Send, {CTRL down} del % inputnumber %} {CTRL up}
; Resetinputnumber ()
; Return
;
;;}
;
; Pasting
; P:; paste at New Line
; Ifinstring, clipboard, 'n'
;{
; Send, {end} {enter} ^ V {del}
;}
; Else
;{
; Send, {end} {enter} ^ V; ^ V
;}
; Return
;
; + P:; paste at beginning of line (does not work for some reason)
; Ifinstring, clipboard, 'n'
;{
; Send, {home} ^ V {enter}
;}
; Else
;{
; Send, ^ V
;}
; Return
;
; Note, this doesnt currently work with multiple selections
; Indenting
;.: Send, {home}'t; indent
;,: Send, {home} {shift down} {tab} {shift up}; UN-indent
;
; Scite commands
; ^ [:; Select previous Tab
;{
; Send, {CTRL down} {shift down} {tab} {shift up} {CTRL up}
; Return
;}
;
; ^]:; Select next tab
;{
; Send, ^ {tab}
; Return
;}
;
; X:; close tab
;{
; Send, ^ W
; Return
;}
;
; S:; save Tab
;{
; Send, ^ s
; Return
;}
;
; # If
}