/usr/share/gps/plug-ins/url.py is in gnat-gps-common 6.1.2016-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """Provides support for some common URLs via the hyper mode in GPS:
- http://
- https://
- file://
- file:\\
"""
import GPS
# Callback for {file,http*}:// URLs
def view_url(url):
try:
if url.startswith("file"):
GPS.MDI.get_by_child(
GPS.EditorBuffer.get(GPS.File(url[7:])).current_view()).raise_window()
else:
GPS.HTML.browse(url)
except:
pass
# Register a highlighter to URLs
GPS.EditorHighlighter(
r'(file:[\\/][\\/][^\s]*|http(s)?://[^\s:,]*)', view_url, 0, view_url)
|