From dcbd169ea8d587f0a800920b48fa41cd342fd714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 31 Oct 2020 02:48:47 +0100 Subject: add "git mode" for explorer windows --- tt.programs.explorer.ahk | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'tt.programs.explorer.ahk') 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 -- cgit v1.2.3