mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
feature: external editor supports Sublime Text
This commit is contained in:
parent
d873f21b6a
commit
1196fabfc1
6 changed files with 101 additions and 4 deletions
|
@ -62,6 +62,7 @@ This app supports open repository in external editors listed in the table below.
|
||||||
| Visual Studio Code | YES | YES | YES | VSCODE_PATH |
|
| Visual Studio Code | YES | YES | YES | VSCODE_PATH |
|
||||||
| Visual Studio Code - Insiders | YES | YES | YES | VSCODE_INSIDERS_PATH |
|
| Visual Studio Code - Insiders | YES | YES | YES | VSCODE_INSIDERS_PATH |
|
||||||
| JetBrains Fleet | YES | YES | YES | FLEET_PATH |
|
| JetBrains Fleet | YES | YES | YES | FLEET_PATH |
|
||||||
|
| Sublime Text | YES | YES | YES | SUBLIME_TEXT_PATH |
|
||||||
|
|
||||||
You can set the given environment variable for special editor if it can NOT be found by this app automatically.
|
You can set the given environment variable for special editor if it can NOT be found by this app automatically.
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@ namespace SourceGit.Models
|
||||||
new ExternalMergeTools(0, "Custom", "", "", ""),
|
new ExternalMergeTools(0, "Custom", "", "", ""),
|
||||||
new ExternalMergeTools(1, "Visual Studio Code", "Code.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(1, "Visual Studio Code", "Code.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(2, "Visual Studio Code - Insiders", "Code - Insiders.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(2, "Visual Studio Code - Insiders", "Code - Insiders.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(3, "Visual Studio 2017/2019", "vsDiffMerge.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" /m", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(3, "Visual Studio 2017/2019/2022", "vsDiffMerge.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" /m", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(4, "Tortoise Merge", "TortoiseMerge.exe;TortoiseGitMerge.exe", "-base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\"", "-base:\"$LOCAL\" -theirs:\"$REMOTE\""),
|
new ExternalMergeTools(4, "Tortoise Merge", "TortoiseMerge.exe;TortoiseGitMerge.exe", "-base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\"", "-base:\"$LOCAL\" -theirs:\"$REMOTE\""),
|
||||||
new ExternalMergeTools(5, "KDiff3", "kdiff3.exe", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(5, "KDiff3", "kdiff3.exe", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(6, "Beyond Compare 4", "BComp.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(6, "Beyond Compare", "BComp.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(7, "WinMerge", "WinMergeU.exe", "-u -e \"$REMOTE\" \"$LOCAL\" \"$MERGED\"", "-u -e \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(7, "WinMerge", "WinMergeU.exe", "-u -e \"$REMOTE\" \"$LOCAL\" \"$MERGED\"", "-u -e \"$LOCAL\" \"$REMOTE\""),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ namespace SourceGit.Models
|
||||||
new ExternalMergeTools(2, "Visual Studio Code", "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(2, "Visual Studio Code", "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(3, "Visual Studio Code - Insiders", "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(3, "Visual Studio Code - Insiders", "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(4, "KDiff3", "/Applications/kdiff3.app/Contents/MacOS/kdiff3", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(4, "KDiff3", "/Applications/kdiff3.app/Contents/MacOS/kdiff3", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(5, "Beyond Compare 4", "/Applications/Beyond Compare.app/Contents/MacOS/bcomp", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(5, "Beyond Compare", "/Applications/Beyond Compare.app/Contents/MacOS/bcomp", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (OperatingSystem.IsLinux())
|
else if (OperatingSystem.IsLinux())
|
||||||
|
@ -47,7 +47,7 @@ namespace SourceGit.Models
|
||||||
new ExternalMergeTools(1, "Visual Studio Code", "/usr/share/code/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(1, "Visual Studio Code", "/usr/share/code/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(2, "Visual Studio Code - Insiders", "/usr/share/code-insiders/code-insiders", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(2, "Visual Studio Code - Insiders", "/usr/share/code-insiders/code-insiders", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(3, "KDiff3", "/usr/bin/kdiff3", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(3, "KDiff3", "/usr/bin/kdiff3", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
new ExternalMergeTools(4, "Beyond Compare 4", "/usr/bin/bcomp", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
new ExternalMergeTools(4, "Beyond Compare", "/usr/bin/bcomp", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -71,6 +71,18 @@ namespace SourceGit.Native
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sublime = FindSublimeText();
|
||||||
|
if (!string.IsNullOrEmpty(sublime) && File.Exists(sublime))
|
||||||
|
{
|
||||||
|
editors.Add(new Models.ExternalEditor
|
||||||
|
{
|
||||||
|
Name = "Sublime Text",
|
||||||
|
Icon = "sublime_text.png",
|
||||||
|
Executable = sublime,
|
||||||
|
OpenCmdArgs = "\"{0}\"",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return editors;
|
return editors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +199,25 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string FindSublimeText()
|
||||||
|
{
|
||||||
|
if (File.Exists("/usr/bin/subl"))
|
||||||
|
{
|
||||||
|
return "/usr/bin/subl";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists("/usr/local/bin/subl"))
|
||||||
|
{
|
||||||
|
return "/usr/local/bin/subl";
|
||||||
|
}
|
||||||
|
|
||||||
|
var customPath = Environment.GetEnvironmentVariable("SUBLIME_TEXT_PATH");
|
||||||
|
if (!string.IsNullOrEmpty(customPath))
|
||||||
|
return customPath;
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,18 @@ namespace SourceGit.Native
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sublime = FindSublimeText();
|
||||||
|
if (!string.IsNullOrEmpty(sublime) && File.Exists(sublime))
|
||||||
|
{
|
||||||
|
editors.Add(new Models.ExternalEditor
|
||||||
|
{
|
||||||
|
Name = "Sublime Text",
|
||||||
|
Icon = "sublime_text.png",
|
||||||
|
Executable = sublime,
|
||||||
|
OpenCmdArgs = "\"{0}\"",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return editors;
|
return editors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +162,20 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string FindSublimeText()
|
||||||
|
{
|
||||||
|
if (File.Exists("/Applications/Sublime Text.app/Contents/SharedSupport/bin"))
|
||||||
|
{
|
||||||
|
return "/Applications/Sublime Text.app/Contents/SharedSupport/bin";
|
||||||
|
}
|
||||||
|
|
||||||
|
var customPath = Environment.GetEnvironmentVariable("SUBLIME_TEXT_PATH");
|
||||||
|
if (!string.IsNullOrEmpty(customPath))
|
||||||
|
return customPath;
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,18 @@ namespace SourceGit.Native
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sublime = FindSublimeText();
|
||||||
|
if (!string.IsNullOrEmpty(sublime) && File.Exists(sublime))
|
||||||
|
{
|
||||||
|
editors.Add(new Models.ExternalEditor
|
||||||
|
{
|
||||||
|
Name = "Sublime Text",
|
||||||
|
Icon = "sublime_text.png",
|
||||||
|
Executable = sublime,
|
||||||
|
OpenCmdArgs = "\"{0}\"",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return editors;
|
return editors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +315,33 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string FindSublimeText()
|
||||||
|
{
|
||||||
|
var localMachine = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||||
|
Microsoft.Win32.RegistryHive.LocalMachine,
|
||||||
|
Microsoft.Win32.RegistryView.Registry64);
|
||||||
|
|
||||||
|
var sublime = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sublime Text_is1");
|
||||||
|
if (sublime != null)
|
||||||
|
{
|
||||||
|
var icon = sublime.GetValue("DisplayIcon") as string;
|
||||||
|
return Path.Combine(Path.GetDirectoryName(icon), "subl.exe");
|
||||||
|
}
|
||||||
|
|
||||||
|
var sublime3 = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sublime Text 3_is1");
|
||||||
|
if (sublime3 != null)
|
||||||
|
{
|
||||||
|
var icon = sublime3.GetValue("DisplayIcon") as string;
|
||||||
|
return Path.Combine(Path.GetDirectoryName(icon), "subl.exe");
|
||||||
|
}
|
||||||
|
|
||||||
|
var customPath = Environment.GetEnvironmentVariable("SUBLIME_TEXT_PATH");
|
||||||
|
if (!string.IsNullOrEmpty(customPath))
|
||||||
|
return customPath;
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void OpenFolderAndSelectFile(string folderPath)
|
private void OpenFolderAndSelectFile(string folderPath)
|
||||||
|
|
BIN
src/Resources/ExternalToolIcons/sublime_text.png
Normal file
BIN
src/Resources/ExternalToolIcons/sublime_text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in a new issue