diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2022-08-05 10:29:11 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2022-08-05 10:29:11 +0200 |
commit | e7bbebfb1d088d6efb30205e1f4d0e2cd6264e52 (patch) | |
tree | 758107e32e4c9a3abeddd675c47e5dc48c11ad95 | |
parent | 095329fc4bf7d5ecea7065a6889b9928bcdf5789 (diff) | |
download | vis-jump-e7bbebfb1d088d6efb30205e1f4d0e2cd6264e52.tar.gz |
Include GitHub discussions.
https://github.com/encode/httpx/discussions/1735 leads to gh#encode/httpx!1735
-rwxr-xr-x[l---------] | abbrevURL.lua | 64 | ||||
-rw-r--r-- | init.lua | 2 |
2 files changed, 64 insertions, 2 deletions
diff --git a/abbrevURL.lua b/abbrevURL.lua index 11f2878..b1c0c2d 120000..100755 --- a/abbrevURL.lua +++ b/abbrevURL.lua @@ -1 +1,63 @@ -../../../../../.local/share/nvim/site/pack/packer/start/vim-suse-changes.git/abbrevURL
\ No newline at end of file +#!/usr/bin/lua +-- Abbreviate according to +-- https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations + +local str = '' + +if #arg == 0 then +str = io.read("*l") +else +str = arg[1]:lower() +end + +str = str:gsub("https?://github.com/(.*)/issues/(%d+)", "gh#%1#%2") +str = str:gsub("https?://github.com/(.*)/pull/(%d+)", "gh#%1#%2") +str = str:gsub("https?://github.com/(.*)/discussions/(%d+)", "gh#%1!%2") +str = str:gsub("https?://github.com/(.*)/commit/(%w+)", function (r, i) + return "gh#" .. r .. "@" .. i:sub(1, 12) +end) +str = str:gsub("https?://gitlab.com/(.*)/issues/(%d+)", "gl#%1#%2") +str = str:gsub("https?://gitlab.com/(.*)/pull/(%d+)", "gl#%1#%2") +str = str:gsub("https?://gitlab.com/(.*)/-/issues/(%d+)", "gl#%1#%2") +str = str:gsub("https?://gitlab.com/(.*)/-/pull/(%d+)", "gl#%1#%2") +str = str:gsub("https?://gitlab.com/(.*)/-/merge-requests/(%d+)", "gl#%1#%2") +str = str:gsub("https?://sourceforge.net/support/tracker.php%?aid=(%d+)", "sh#%1") +str = str:gsub("https?://sf.net/support/tracker.php%?aid=(%d+)", "sh#%1") +str = str:gsub("https?://sourceforge.net/p/(.*)/patches/(%d+)/", "shp#%1#%2") +str = str:gsub("https?://sourceforge.net/p/(.*)/bugs/(%d+)/", "shb#%1#%2") +str = str:gsub("https?://sourceforge.net/p/(.*)/tickets/(%d+)/", "sht#%1#%2") +str = str:gsub("https?://sf.net/support/p/(.*)/patches/(%d+)/", "shp#%1#%2") +str = str:gsub("https?://sf.net/support/p/(.*)/bugs/(%d+)/", "shb#%1#%2") +str = str:gsub("https?://sf.net/support/p/(.*)/tickets/(%d+)/", "sht#%1#%2") +str = str:gsub("https?://bitbucket.org/(.*)/issues/(%d+)/", "bt#%1#%2") +str = str:gsub("https?://build.suse.de/request/show/(%d+)", "ssr#%1") +str = str:gsub("https?://build.opensuse.org/request/show/(%d+)", "sr#%1") +str = str:gsub("https?://bugzilla.opensuse.org/show_bug.cgi%?id=(%d+)", "boo#%1") +str = str:gsub("https?://bugzilla.opensuse.org/(%d+)", "boo#%1") +str = str:gsub("https?://bugzilla.suse.com/show_bug.cgi%?id=(%d+)", "bsc#%1") +str = str:gsub("https?://bugzilla.suse.com/(%d+)", "bsc#%1") +str = str:gsub("https?://bugzilla.redhat.com/show_bug.cgi%?id=(%d+)", "rh#%1") +str = str:gsub("https?://bugzilla.redhat.com/(%d+)", "rh#%1") +str = str:gsub("https?://bugzilla.mozilla.org/show_bug.cgi%?id=(%d+)", "bmo#%1") +str = str:gsub("https?://bugzilla.mozilla.org/(%d+)", "bmo#%1") +str = str:gsub("https?://bugs.documentfoundation.org/show_bug.cgi%?id=(%d+)", "tdf#%1") +str = str:gsub("https?://bugs.documentfoundation.org/(%d+)", "tdf#%1") +str = str:gsub("https?://jira.suse.com/browse/(%a+)", "jsc#%1") +str = str:gsub("https?://bugs.python.org/issue(%d+)", "bpo#%1") +str = str:gsub("https?://bugs.launchpad.net/.+/%+bug/(%d+)", "lp#%1") +str = str:gsub("https?://www.python.org/dev/peps/pep%-(%d+)/?", "pep#%1") +str = str:gsub("https?://svn.boost.org/trac/boost/(%d+)", "boost#%1") +str = str:gsub("https?://rt.cpan.org/Public/(%d+)", "RT#%1") +str = str:gsub("https?://bugs.debian.org/(%d+)", "deb#%1") +str = str:gsub("https?://bugs.freedesktop.org/(%d+)", "fdo#%1") +str = str:gsub("https?://gitlab.freedesktop.org/(%a+)/issues/(%d+)", "glfo#%1#%2") +str = str:gsub("https?://gcc.gnu.org/bugzilla/(%d+)", "gcc#%1") +str = str:gsub("https?://gitlab.gnome.org/(%a+)/issues/(%d+)", "glgo#%1#%2") +str = str:gsub("https?://bugs.kde.org/(%d+)", "kde#%1") +str = str:gsub("https?://api.github.com/repos/openSUSE/open-build-service/issues/(%d+)", "obs#%1") +str = str:gsub("https?://api.github.com/repos/openSUSE/obs-build/issues/(%d+)", "build#%1") +str = str:gsub("https?://api.github.com/repos/openSUSE/osc/issues/(%d+)", "osc#%1") +str = str:gsub("https?://progress.opensuse.org/issues/(%d+)", "poo#%1") +str = str:gsub("https?://developerbugs.linux-foundation.org/(%d+)", "lf#%1") + +print(str) @@ -18,7 +18,7 @@ M.get_query = function() local str = vis.win.file.lines[line] local len_str = string.len(str) - local URLchars = '[^a-zA-Z0-9%?._=+;&/:@#-]' + local URLchars = '[^a-zA-Z0-9%?._=+;&/:@#!-]' local to = str:find(URLchars, pos) if to == nil then to = len_str else to = to - 1 end local from = str:reverse():find(URLchars, len_str - pos + 1) |