aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-31 13:41:26 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-10-31 13:47:28 +0100
commit174ac9ea9434e6755b683dfbff6f9194cad480f5 (patch)
treefd123b7b0ed7af608823d4de87c8e835e64d22da
parentdcbd169ea8d587f0a800920b48fa41cd342fd714 (diff)
downloadahk-174ac9ea9434e6755b683dfbff6f9194cad480f5.tar.gz
use alt hotkeys for git mode instead of prefix
-rw-r--r--tt.programs.explorer.ahk59
1 files changed, 28 insertions, 31 deletions
diff --git a/tt.programs.explorer.ahk b/tt.programs.explorer.ahk
index 452888b..0e57d65 100644
--- a/tt.programs.explorer.ahk
+++ b/tt.programs.explorer.ahk
@@ -196,7 +196,7 @@ ExplorerFolderView(view, children := false)
SetBatchLines, % old
}
-;; Git mode -------------------------------------------------------------------
+;; Git hotkeys ----------------------------------------------------------------
;; -> library
@@ -205,39 +205,36 @@ q(s)
return """" s """"
}
+qp()
+{
+ return q(Explorer().Document.Folder.Self.path)
+}
+
+qip()
+{
+ return q(Explorer().Document.FocusedItem.path)
+}
+
+basename(s)
+{
+ slash := InStr(path, "\", 0, 0)
+ return SubStr(path, slash + 1)
+}
+
;; -> body
#IfWinActive ahk_group Explorer
-#g::
-ToolTip, ...
-SendInput, {Blind}{LWin Up}
-Input, k, C L1
-
-ex := Explorer()
-i := ex.Document.FocusedItem.path
-path := ex.Document.Folder.Self.path
-slash := InStr(path, "\", 0, 0)
-basename := SubStr(path, slash + 1)
-
-if (k = "a")
- Run, % "cmd /c cd "q(path)" & git add "q(i)" && git status & pause"
-if (k = "c")
- Run, % "cmd /c cd "q(path)" & git commit & pause"
-if (k = "d")
- Run, % "cmd /c cd "q(path)" & git diff "q(i)" & pause"
-if (k = "f")
- Run, % "cmd /c cd "q(path)" & git diff & pause"
-if (k = "m")
- Run, % "cmd /c cd "q(path)" & git commit --amend & pause"
-if (k = "p")
- Run, % "cmd /c cd "q(path)" & git push origin "q(basename)" & pause"
-if (k = "r")
- Run, % "cmd /c cd "q(path)" & git reset "q(i)" && git status & pause"
-if (k = "s")
- Run, % "cmd /c cd "q(path)" & git status & pause"
-
-ToolTip
-return
+!a::Run, % "cmd /c cd "qp()" & git add "qip()" && git status & pause"
+!c::Run, % "cmd /c cd "qp()" & git commit & pause"
+!+c::Run, % "cmd /c cd "qp()" & git commit --amend & pause"
+!d::Run, % "cmd /c cd "qp()" & git diff "qip()" & pause"
+!+d::Run, % "cmd /c cd "qp()" & git diff & pause"
+!f::Run, % "cmd /c cd "qp()" & git diff HEAD~1 HEAD "qip()" & pause"
+!+f::Run, % "cmd /c cd "qp()" & git diff HEAD~1 HEAD & pause"
+!l::Run, % "cmd /c cd "qp()" & git log & pause"
+!p::Run, % "cmd /c cd "qp()" & git push origin "q(basename)" & pause"
+!r::Run, % "cmd /c cd "qp()" & git reset "qip()" && git status & pause"
+!s::Run, % "cmd /c cd "qp()" & git status & pause"
#IfWinActive