From 524edea420a1797ecfa3a68f44879f5214ca8a27 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 18 Sep 2017 19:55:13 -0300 Subject: More yanking --- config.dot/luakit.link/binds.lua | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) 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 = '' .. title .. '' + 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), -- cgit v1.2.3