aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-31 02:48:47 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-10-31 02:51:57 +0100
commitdcbd169ea8d587f0a800920b48fa41cd342fd714 (patch)
tree73fa5f36aa80ac0a14a0d1cdc0b46190f18c9fe0
parent6c365185cbb5e43a3b17e87692e9f0b979563a8f (diff)
downloadahk-dcbd169ea8d587f0a800920b48fa41cd342fd714.tar.gz
add "git mode" for explorer windows
-rw-r--r--tt.programs.explorer.ahk46
1 files changed, 46 insertions, 0 deletions
diff --git a/tt.programs.explorer.ahk b/tt.programs.explorer.ahk
index 8e2e659..452888b 100644
--- a/tt.programs.explorer.ahk
+++ b/tt.programs.explorer.ahk
@@ -195,3 +195,49 @@ ExplorerFolderView(view, children := false)
SetBatchLines, % old
}
+
+;; Git mode -------------------------------------------------------------------
+
+;; -> library
+
+q(s)
+{
+ return """" s """"
+}
+
+;; -> 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
+
+#IfWinActive