It's pretty crude, but I'm basically using AHK to remap keyboard keys within XY to be used as navigation and XY hotkeys (commands, scripts, etc). When in "insert mode" I have bash-like line navigation for quickly jumping the carat around the line.
for "insert mode" (which will temporarily return the keyboard to normal until <CTRL-[> or <Esc> is pressed), etc...
Aside from vim-like navigation, I've mapped XY specific things to keys that I've found intuitive:
for Quick Search + Insert Mode, etc.
It's kind of a hot-mess to anyone but me, but I've been using this script since the first week I started with XY. It works great, since I'm fluent in the keys I remapped I can jump around XY much quicker than if I needed a mouse.
Code: Select all
#SingleInstance Force
#Persistent
#NoEnv
menu, tray, icon, %A_ScriptDir%\icon_active.ico
DetectHiddenWindows, On
SetKeyDelay, 0
GroupAdd, programs, ahk_exe calibre.exe
GroupAdd, programs, ahk_exe Everything64.exe
GroupAdd, programs, ahk_exe mpc-be.exe
GroupAdd, programs, ahk_exe MusicBee.exe
GroupAdd, programs, ahk_exe PDFXEdit.exe
GroupAdd, programs, ahk_exe PortableAppsPlatform.exe
GroupAdd, programs, ahk_exe sizer.exe
GroupAdd, programs, ahk_exe WinSCP.exe
GroupAdd, programs, ahk_exe i_view32.exe
GroupAdd, explorer, ahk_exe explorer.exe
GroupAdd, explorer, ahk_exe Q-Dir_x64.exe
GroupAdd, explorer, ahk_exe XYplorer.exe
; ----- Insert mode -----
GroupAdd, edit_titles, ahk_exe XYplorer.exe ; XYplorer
GroupAdd, edit_titles, ahk_exe MusicBee.exe ; MusicBee
; Text input ID's for various programs and windows
edit_controls := "Edit1|Edit2|Edit16|Edit17|Edit18|Edit19|Edit20|Edit21|WindowsForms10.EDIT.app.0.2bf8098_r7_ad11"
; Bash-like text navigation (If a program in either group and insert mode is active)
#If (WinActive("ahk_group programs") or WinActive("ahk_group explorer")) and (insert_status := _insert_status())
^a::Send {Home} ; Beggining
^b::Send {Left} ; Left
!b::Send ^{Left} ; Back a word
!d::^Delete ; Delete next word
^d::Send {Delete} ; Delete nex character
^e::Send {End} ; End
!f::Send ^{Right} ; Forward a word
^f::Send {Right} ; Right
^h::Send {Backspace} ; Backspace
^k::Send +{End}{Delete} ; Delete everything after the cursour
^n::Send {Down} ; Down
^p::Send {Up} ; Up
!r::Send ^z ; Undo
^u::Send +{Home}{Delete} ; Delete everything before cursour
^w::Send ^+{Left}{Delete}
^y::Send ^v ; Paste
^c:: ; Copy
Send ^c
if (A_PriorHotkey == "^c") and (A_TimeSincePriorHotkey < 300)
{
; Copy all
Send ^a^c{Right}
return
}
return
Escape:: ; Exit insert mode
SplashImage, off
menu, tray, icon, %A_ScriptDir%\icon_active.ico
insert_mode := False
return
^[:: ; <Esc> and exit insert mode
Send {Escape}
Sleep, 100
if (!edit_status := _edit_status(edit_controls))
{
SplashImage, off
menu, tray, icon, %A_ScriptDir%\icon_active.ico
insert_mode := False
return
}
return
Enter:: ; <Enter> and exit insert mode
Send {Enter}
Sleep, 100
if (!edit_status := _edit_status(edit_controls))
{
SplashImage, off
menu, tray, icon, %A_ScriptDir%\icon_active.ico
insert_mode := False
return
}
return
Tab:: ; <Tab> and exit insert mode
Send {Tab}
Sleep, 100
if (!edit_status := _edit_status(edit_controls))
{
SplashImage, off
menu, tray, icon, %A_ScriptDir%\icon_active.ico
insert_mode := False
return
}
return
#if
; Vim-Like naviation (If a program from the group 'programs' is active and NOT insert mode)
#If WinActive("ahk_group programs") and (!insert_status := _insert_status())
^[::Send {Escape} ; Escape
^b::Send {PgUp} ; Page-up
^d::Send {Down 5} ; 5 lines down
^f::Send {PgDn} ; Page-down
+g::Send {End} ; End
^h::^+Tab ; Previous tab
h::Send {Left} ; Left
j::Send {Down} ; Down
k::Send {Up} ; Up
^l::^Tab ; Next tab
l::Send {Right} ; Right
m::AppsKey ; Shortcut menu (Right-click)
^u::Send {Up 5} ; 5 lines up
i:: ; Insert Mode
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
/::
Send ^f ; Search
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
g::
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 300)
{
; Top
Send {Home}
return
}
return
+t::
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 800)
{
; Previous tab
Send ^+{Tab}
return
}
return
t::
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 800)
{
; Next tab
Send ^{Tab}
return
}
if (A_Priorkey == "d") and (A_TimeSincePriorKey < 800)
{
; Close tab
Send ^w
return
}
return
#IfWinActive
; Vim-Like Navigation (If a program from the group 'explorer' is active, and NOT insert mode) ! Lots of xyPlorer exclusive hotkeys
#If WinActive("ahk_group explorer") and (!insert_status := _insert_status())
|::Send ^+!l ; #811 = Swap Locations
^[::Send {Escape} ; #1000 = Escape
[::!Left ; #527 = Navigate Back
]::!Right ; #528 = Navigate Forward
`;::^+l ; #533 = Go-to Line
$::Send +{End} ; Highlight until last
^::Send +{Home} ; Highlight until first
+::Send +{PgUp} ; Highlight Page-up
_::Send +{PgDn} ; Highlight Page-down
%::Send ^a ; #250 = Select All
^Space::Send ^!m ; #253 = Smart Selection filter (+Insert Mode)
a::Send ^+!0 ; Script = Applications.xys
^b::Send {PgUp} ; Page-up
c::^+!4 ; Script = XYCollector.xys
^d::Send {Down 10} ; 10x Down
f::^+!8 ; Script = FolderPanePreview.xys
+g::Send {End} ; Bottom
^+h::Send ^+![ ; #1044 = Move tab Left
^h::^+Tab ; #1019 = Previous tab
+h::+Left ; Highlight Left
h::Send {Left} ; Left
+j::+Down ; Highlight Down
j::Send {Down} ; Down
+k::+Up ; Highlight Up
k::Send {Up} ; Up
^+l::Send ^+!] ; #1045 = Move tab Right
^l::^Tab ; #1018 = Next tab
+l::+Right ; Highlight Right
l::Send {Right} ; Right
^f::Send {PgDn} ; Page-down
+m::^+!5 ; Script = Operations.xys
m::^+!1 ; Script = Launcher.xys
n::Send ^+!n ; #240 = New item menu
+o::Send ^+!' ; #1063 = Open item in new tab in other pane
o::Send ^+!; ; #1043 = Open item in new tab
^p::Send {F11} ; #168 = Pop-up preview
+p::Send ^4 ; #1023 = Preview window
p::^v ; #202 = Paste
^r::^+z ; #204 = Re-do
+r::^+!3 ; Script = XYColumnsEdit.xys
+s::Send +{F5} ; #487 = Calculate Folder Size
s::^+!2 ; Script = SessionsMenu.xys
^u::Send {Up 10} ; 10x Up
+u::Send ^+!u ; #343 = Re-open last closed tab
u::^z ; #203 = Undo
^v::^+!6 ; Script = QuickFolderViews.xys
v::Send ^+{F5} ; #486 = Reset view
+Space::
Send ^+!b ; #415 = Toggle Checkboxes
Send ^+!s ; #413 = Toggle Sticky Selection
return
!Space:: ; #254 = Select by Selected Type(s)
Send ^m
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
\:: ; #1014 = Focus on Address Bar
Send !`;
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
+/:: ; #266 = Quick Search (+Insert Mode)
Send {F3}
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
/:: ; #1080 = Live-Filter (+Insert Mode)
Send ^!x
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
+`;:: ; #532 = Go-to Folder
Send ^+g
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
+d::
if (A_PriorHotkey == "+d") and (A_TimeSincePriorHotkey < 300)
{
; #170 = Delete no Recycle Bin
Send +{Delete}
return
}
return
d::
if (A_PriorHotkey == "d") and (A_TimeSincePriorHotkey < 300)
{
; #169 = Delete
Send {Delete}
return
}
return
e:: ; Script = Everything.xys (+Insert Mode)
Send ^+!9
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
g::
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 300)
{
; Top
Send {Home}
return
}
return
i:: ; Insert Mode
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
+n:: ; Script = CreatedNestedItems.xys (+Insert Mode)
Send ^+!7
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
r:: ; #172 = Rename current file(s)
Send {F2}
SplashImage, %A_ScriptDir%\insert_mode.png, B X0 Y950
WinSet, TransColor, FFFFFF 100, Vim-Like.ahk
menu, tray, icon, %A_ScriptDir%\icon_suspended.ico
insert_mode := True
return
+t::
if (A_PriorHotkey == "+t") and (A_TimeSincePriorHotkey < 300)
{
; #806 = Duplicate tab to other pane
Send ^+!t
return
}
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 800)
{
; #1019 = Previous tab
Send ^+{Tab}
return
}
return
t::
if (A_PriorHotkey == "t") and (A_TimeSincePriorHotkey < 300)
{
; #543 = Duplicate tab to same pane
Send ^+!z
return
}
if (A_PriorHotkey == "g") and (A_TimeSincePriorHotkey < 800)
{
; #1018 = Next tab
Send ^{Tab}
return
}
if (A_PriorHotkey == "d") and (A_TimeSincePriorKey < 800)
{
; #351 = Close tab
Send ^w
return
}
return
y::
if (A_PriorHotkey == "y") and (A_TimeSincePriorHotkey < 300)
{
; #201 = Copy
Send ^c
return
}
return
x::
if (A_PriorHotkey == "x") and (A_TimeSincePriorHotkey < 300)
{
; #200 = Cut
Send ^x
return
}
return
#If
_insert_status(){
global insert_mode
return %insert_mode%
}
_edit_status(list_of_edit_controls){
ControlGetFocus, focused_control, A
current_control := InStr(list_of_edit_controls . "|", focused_control . "|") ? focused_control : false
return current_control
}