I've switched recently to FAR3 from FAR1. I've used this plugin to open URLs from the editor. Since it's not maintained anymore, I decided to mimick its feature by macro (FML).
Use it if you wish (fix bugs, customize it), it's just an idea. Also, if you can point me to a better solution (macro/plugin), please do so.
Here it is, it does what I wrote earlier:
Code: Select all
macro Areas="Editor" Bind="CtrlH" Condition="Selected:0" Description="Editor - Open Link" Name="EditorOpenLink" {{
History.Disable(1)
%position = Editor.CurPos;
End
Editor.Undo(0)
Print(" ")
Editor.Undo(1)
Editor.Pos(1, 2, %position)
$While (Editor.CurPos != 1 && substr(Editor.Value, Editor.CurPos - 1, 1) != " " && substr(Editor.Value, Editor.CurPos - 1, 1) != "\"" && substr(Editor.Value, Editor.CurPos - 1, 1) != "'" && substr(Editor.Value, Editor.CurPos - 1, 1) != "{")
Left
$End
$If (Editor.CurPos != 1 || substr(Editor.Value, Editor.CurPos - 1, 1) == " " || substr(Editor.Value, Editor.CurPos - 1, 1) == "\"" || substr(Editor.Value, Editor.CurPos - 1, 1) == "'" || substr(Editor.Value, Editor.CurPos - 1, 1) == "{")
Right
$End
$If (substr(Editor.Value, Editor.CurPos - 1, 4) != "http")
Editor.Undo(2)
Editor.Pos(1, 2, %position)
$Exit
$End
$While (substr(Editor.Value, Editor.CurPos - 1, 1) != " " && substr(Editor.Value, Editor.CurPos - 1, 1) != "\"" && substr(Editor.Value, Editor.CurPos - 1, 1) != "'" && substr(Editor.Value, Editor.CurPos - 1, 1) != "}")
ShiftRight
$End
%link = Editor.SelValue;
F12
%screenNumber = GetHotkey();
0
Esc
Print(@"run:nul<start " + %link)
Enter
F12
Print(%screenNumber)
Editor.Undo(2)
Home
Editor.Pos(1, 2, %position)
}}
- Uses Windows default URL handler (means default browser)
Opens the links which starts with http
Won't work correctly on for example (http://example.com), so when there's an extra character at the start/end. Works if the extra characters are either single or double quotes or curly braces (as you can see in the ugly code). Idea: call external URL parser?
Destroys command line content
Code: Select all
macro Areas="Editor" Bind="CtrlAltH" Condition="Selected:1" Description="Editor - Search Internet" Name="EditorSearchInternet" {{
History.Disable(1)
%term = Editor.SelValue;
F12
%screenNumber = GetHotkey();
0
Esc
Print("run:nul<|\"" + %%BrowserPath + "\"|start \"\" \"" + %%BrowserExecutable + "\" ? " + %term)
Enter
F12
Print(%screenNumber)
}}
Code: Select all
macro Areas="Shell" Description="OnStart" Events="Open" Name="OnStart" {{
$If (Env("PROCESSOR_ARCHITECTURE") == "x86")
%%BrowserPath = Env("ProgramFiles");
$Else
%%BrowserPath = Env("ProgramFiles(x86)");
$End
%%BrowserPath = %%BrowserPath + @"\Internet Explorer";
%%BrowserExecutable = "IExplore.exe";
MSave("%%BrowserPath")
MSave("%%BrowserExecutable")
}}