mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00: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
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -187,6 +199,25 @@ namespace SourceGit.Native
|
|||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue