Bonjour,
En faisant une petite recherche, j'ai découvert qu'il était possible d'ouvrir un URL via une combinaison de touche.
Sous Windows: il faut placer le curseur sur l'URL et combiner les touches [CRTL]+[MAJ]+[O]
Sous Linux, il semblerait qu'il faille mettre les mains au cambouis. Il faut faire comme expliqué sur la page
http://lua-users.org/wiki/SciteOpenUrl pour pouvoir ouvrir un tel lien avec la combinaison [CTRL]+['].
Dans les grandes lignes, il faut ajouter au fichier ~/.SciTEUser.properties les lignes suivantes :
- Code: Tout sélectionner
ext.lua.startup.script=$(SciteUserHome)/open_url.lua
command.name.1.*=Open URL in Browser
command.1.*=open_url
command.subsystem.1.*=3
command.mode.1.*=savebefore:no
command.shortcut.1.*=Ctrl+'
Et ceci dans le fichier ~/open_url.lua
- Code: Tout sélectionner
-- opens URL via selection or by checking text under cursor
-- Kein-Hong Man <khman@users.sf.net> Public Domain 2008
-- * execute call is non-Win32! tested on Ubuntu 6.10
-- * URL delimited by ", ' or whitespace
-- * does nothing about text encoding!
function open_url()
local string = string
local function charat(s, p) return string.sub(s, p, p) end
local function delim(c) return string.match(c, "[\"'%s]") end
-- if there is a selection, use exactly, else analyze
local txt = editor:GetSelText()
if #txt == 0 then
-- get details of current line, position
local p1 = editor.CurrentPos
local ln = editor:LineFromPosition(p1)
txt = editor:GetLine(ln)
if not txt then return end
local p2 = editor:PositionFromLine(ln)
p1 = p1 - p2 + 1; p2 = p1
-- extend text segment to left
while p1 > 1 do
if delim(charat(txt, p1 - 1)) then break end
p1 = p1 - 1
end
-- extend text segment to right
while p2 <= #txt do
if delim(charat(txt, p2)) then break end
p2 = p2 + 1
end
-- exit if nothing matched
if p1 == p2 then return end
txt = string.sub(txt, p1, p2 - 1)
else
-- trim extraneous whitespace
txt = string.gsub(txt, "^%s*(.-)%s*$", "%1")
-- fail on embedded whitespace
if string.match(txt, "%s") then return end
end
if string.match(txt, "^http://.+") or
string.match(txt, "^https://.+") or
string.match(txt, "^ftp://.+") or
string.match(txt, "^www%..+") then
--print("URL='"..txt.."'") --DEBUG
os.execute("x-www-browser "..txt.." &")
end
end
J'ai essayé sur Ubuntu 16.10 et ça fonctionne. Il me semble que la seule condition pour que ce ne fonctionne pas sur une autre distrib, c'est qu'elle ne reconnaisse pas la commande x-www-browser pour démarrer le navigateur par défaut.
Maintenant, en ce qui concerne le soulignement ou la mise en surbrillance, j'ai difficile à cerner une solution élégante.