aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.dot/luakit.link/binds.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/config.dot/luakit.link/binds.lua b/config.dot/luakit.link/binds.lua
index 4ec70ec..b2b10d4 100644
--- a/config.dot/luakit.link/binds.lua
+++ b/config.dot/luakit.link/binds.lua
@@ -186,6 +186,56 @@ add_binds("normal", {
w:notify("Yanked title: " .. title)
end),
+ -- Yank URL and title as a Markdown link
+ buf("^ym$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '[' .. title .. '](' .. uri .. ')'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a reStructuredText link
+ buf("^yr$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '`' .. title .. '` <' .. uri .. '>`_'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a Trac link
+ buf("^yc$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '[' .. uri .. ' ' .. title .. ']'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as an HTML link
+ buf("^yh$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '<a href="' .. uri .. '">' .. title .. '</a>'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a shareable link
+ buf("^ys$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = title .. ' - ' .. uri
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
-- Commands
key({"Control"}, "a", function (w) w:navigate(w:inc_uri(1)) end),
key({"Control"}, "x", function (w) w:navigate(w:inc_uri(-1)) end),