From: Silvio Rhatto Date: Mon, 18 Sep 2017 22:55:13 +0000 (-0300) Subject: More yanking X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=524edea420a1797ecfa3a68f44879f5214ca8a27;p=rhatto%2Fdotfiles%2Fluakit.git More yanking --- 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),